---
title: StringExtensions
summary: API reference for StringExtensions.
status: draft
owner: saif-docgen
last_reviewed: 2026-09-15
library: SAIF.Framework.Common
reference_type: package
---

# StringExtensions

The library's largest extension surface: null/blank testing, boolean parsing, slicing/truncation, case conversion (including delegation to `TitleCase`), Unicode normalization, numeric-character testing, decimal conversion, and string wrapping. ([BR-072](../../business-rules.md#br-072-a-string-is-truthy-only-when-it-uppercases-to-one-of-y%2C-yes%2C-true%2C-1%2C-or-on), [BR-074](../../business-rules.md#br-074-non-ascii-typographic-characters-are-folded-to-ascii-equivalents-before-text-leaves-the-system), [BR-076](<../../business-rules.md#br-076-truncate-is-length-safe-(clamps-and-tolerates-null)>)) through [BR-078](../../business-rules.md#br-078-a-null-or-whitespace-decimal-string-converts-to-zero-rather-than-raising-an-error)

## Purpose
- The library's largest extension surface: null/blank testing, boolean parsing, slicing/truncation, case conversion (including delegation to `TitleCase`), Unicode normalization, numeric-character testing, decimal conversion, and string wrapping. ([BR-072](../../business-rules.md#br-072-a-string-is-truthy-only-when-it-uppercases-to-one-of-y%2C-yes%2C-true%2C-1%2C-or-on), [BR-074](../../business-rules.md#br-074-non-ascii-typographic-characters-are-folded-to-ascii-equivalents-before-text-leaves-the-system), [BR-076](<../../business-rules.md#br-076-truncate-is-length-safe-(clamps-and-tolerates-null)>)) through [BR-078](../../business-rules.md#br-078-a-null-or-whitespace-decimal-string-converts-to-zero-rather-than-raising-an-error)

## Context
- Namespace: `SAIF.Common.Extensions`
- Assembly/package: `SAIF.Framework.Common`

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| IsNullOrEmpty(this string value) | `public static bool IsNullOrEmpty(this string value)` | Extension-method form of `string.IsNullOrEmpty`. |
| IsNullOrWhiteSpace(this string value) | `public static bool IsNullOrWhiteSpace(this string value)` | Extension-method form of `string.IsNullOrWhiteSpace`. |
| ToBoolean(this string value) | `public static bool ToBoolean(this string value)` | Returns false for null, otherwise true only if the uppercased value is one of `Y`/`YES`/`TRUE`/`1`/`ON`. ([BR-072](../../business-rules.md#br-072-a-string-is-truthy-only-when-it-uppercases-to-one-of-y%2C-yes%2C-true%2C-1%2C-or-on)) |
| Left(this string value, int length) | `public static string Left(this string value, int length)` | Returns the leftmost `length` characters; throws `ArgumentOutOfRangeException` if `length` exceeds the string's length. ([BR-076](<../../business-rules.md#br-076-truncate-is-length-safe-(clamps-and-tolerates-null)>)) |
| Right(this string value, int length) | `public static string Right(this string value, int length)` | Returns the rightmost `length` characters; throws `ArgumentOutOfRangeException` if `length` exceeds the string's length. ([BR-076](<../../business-rules.md#br-076-truncate-is-length-safe-(clamps-and-tolerates-null)>)) |
| Truncate(this string value, int length) | `public static string Truncate(this string value, int length)` | Null-safe clamped truncation using `Math.Min(value.Length, length)`, never throwing. ([BR-076](<../../business-rules.md#br-076-truncate-is-length-safe-(clamps-and-tolerates-null)>)) |
| Repeat(this string value, int count) | `public static string Repeat(this string value, int count)` | Concatenates `value` with itself `count` times. |
| ToTitleCase(this string value) | `public static string ToTitleCase(this string value)` | Title-cases an entire multi-word string, delegating to `SAIF.Common.Utility.TitleCase`. ([BR-014](../../business-rules.md#br-014-title-casing-of-a-null-or-empty-string-is-a-no-op)) through [BR-021](../../business-rules.md#br-021-the-first-character-of-any-title-cased-result-is-always-uppercase%2C-regardless-of-every-other-rule) |
| ToProperCase(this string value) | `public static string ToProperCase(this string value)` | Title-cases a single word, delegating to `SAIF.Common.Utility.TitleCase`. ([BR-015](../../business-rules.md#br-015-a-word-that-already-contains-both-uppercase-and-lowercase-characters-is-assumed-intentionally-cased)) through [BR-020](../../business-rules.md#br-020-a-trailing-possessive-'s-is-normalized-to-lowercase-after-casing) |
| ReplaceUnicodeCharactersWithAscii(this string value) | `public static string ReplaceUnicodeCharactersWithAscii(this string value)` | Folds curly quotes, bullets, dashes, and NUL to their nearest ASCII equivalents; null-safe (returns empty string). ([BR-074](../../business-rules.md#br-074-non-ascii-typographic-characters-are-folded-to-ascii-equivalents-before-text-leaves-the-system)) |
| ToLower(this string[] values) | `public static string[] ToLower(this string[] values)` | Lower-cases every element of a string array. |
| ToUpper(this string[] values) | `public static string[] ToUpper(this string[] values)` | Upper-cases every element of a string array. |
| ContainsOnlyNumericCharacters(this string value) | `public static bool ContainsOnlyNumericCharacters(this string value)` | True only when every character is a digit and the string is non-null/non-empty, via a `\D` regex test. ([BR-077](../../business-rules.md#br-077-a-string-contains-only-numeric-characters-only-when-it-is-non-empty-and-contains-no-non-digit-character-at-all)) |
| ConvertToDecimalOrZero(this string value) | `public static decimal ConvertToDecimalOrZero(this string value)` | Returns 0 for null/whitespace input, otherwise `Convert.ToDecimal` (which throws `FormatException` on non-numeric text). ([BR-078](../../business-rules.md#br-078-a-null-or-whitespace-decimal-string-converts-to-zero-rather-than-raising-an-error)) |
| Wrap(this string value, string wrapValue) | `public static string Wrap(this string value, string wrapValue)` | Returns `$"{wrapValue}{value}{wrapValue}"`. |


## Sources
- `Common/SAIF.Common/Extensions/StringExtensions.cs`
