TitleCaseExtensions¶
A public module providing extension methods for string and string-array formatting operations. When SAIF.Business.Utilities is imported, these methods become available directly on String and String() objects in any consuming project — a wide ambient surface that adds casing, validation, and padding capabilities to the BCL string type. All members are public and shared; the module holds no state.
Purpose¶
- Provide convenient extension-method façade over
TitleCase.ToTitleCasefor the title-casing operation commonly needed by display-layer code. - Support supplementary string-formatting operations: proper casing, capital-letter padding, numeric validation, array-level casing for use in word-list comparisons.
Context¶
- Namespace:
SAIF.Business.Utilities - Assembly/package:
SAIF.Business.Utilities.dll - Module type: VB.NET
Public Module(all members are extension methods decorated with<System.Runtime.CompilerServices.Extension()>)
Public members¶
| Member | Signature | Purpose |
|---|---|---|
ToTitleCase |
Public Function ToTitleCase(ByVal Target As String) As String |
Extension-method façade over TitleCase.ToTitleCase; the primary title-casing method used by callers. Accepts any string and returns the title-cased result using the rules-driven engine. |
ToProperCase |
Public Function ToProperCase(ByVal Target As String) As String |
Apply VB StrConv(..., VbStrConv.ProperCase) for simple per-word capitalization; used as fallback in BR-009 when no recognition list matches. |
ToPadCapitalLetters |
Public Function ToPadCapitalLetters(ByVal Target As String) As String |
Expand run-together identifiers (Pascal-cased text) into spaced words by inserting spaces before capital letters. Skipped if the value already contains a space (BR-018); otherwise delegates to SAIF.Framework.StandardFormats.PadCapitalLettersFormat.ApplyFormat. |
ToLower |
Public Function ToLower(ByVal Target() As String) As String() |
Array-level lower-casing. Accepts a string array and returns a new array with each element lower-cased. Used internally for case-insensitive word-list comparison. |
ToUpper |
Public Function ToUpper(ByVal Target() As String) As String() |
Array-level upper-casing. Accepts a string array and returns a new array with each element upper-cased. Used internally for case-insensitive word-list comparison. |
ContainsOnlyNumericCharacters |
Public Function ContainsOnlyNumericCharacters(ByVal Target As String) As Boolean |
Guard for ordinal suffix detection. Confirms that a string is non-null, non-blank, and contains only digits (no \D match via regex Regex.IsMatch(..., "\\D")). |
Behavioral notes¶
- Ambient surface: Because
TitleCaseExtensionsis aPublic Module, importingSAIF.Business.Utilitiessilently adds these extension methods toStringandString()across any consuming project — a coupling characteristic that may be unexpected*. - Delegation to
TitleCase.ToTitleCase: TheToTitleCaseextension method simply forwards to the staticTitleCase.ToTitleCasemethod; it does not duplicate logic. StrConvbehavior: TheToProperCasemethod uses the VB.NET runtime'sStrConv(..., VbStrConv.ProperCase), which may behave differently across framework versions and locales. On .NET Framework 4.x it typically capitalizes the first letter of each space-delimited word*.PadCapitalLettersFormatdelegation:ToPadCapitalLettersdelegates toSAIF.Framework.StandardFormats.PadCapitalLettersFormat(fromSAIF.Framework.Commonpackage). The exact implementation is not visible in this repository**.- Array methods:
ToLowerandToUpperoperate on string arrays and are used for case-insensitive recognition-list matching (e.g. comparing a token againstUpperCaseWordList.ToUpper()). They return new arrays; the input array is not modified*. - Regex in
ContainsOnlyNumericCharacters: UsesRegex.IsMatch(Target, "\\D")to check for non-digit characters; returns true only if no non-digit is found and the string is not null/blank. - Null/empty handling: Methods generally pass through null values unchanged or apply sensible defaults (e.g.
ToLower/ToUpperreturn empty arrays if input is null); exact behavior per method should be verified from implementation*.
Constraints and usage notes¶
- All members are stateless; calls are thread-safe.
- The module's
Publicvisibility means these extension methods are automatically injected into the namespace scope of any project importingSAIF.Business.Utilities, potentially creating unexpected method availability*. - The
ToPadCapitalLettersmethod's behavior depends on the externalPadCapitalLettersFormattype; changes to that type or its dependencies may affect output**. - Array-level methods (
ToLower,ToUpper) allocate new arrays; no in-place modification occurs. - The regex pattern in
ContainsOnlyNumericCharactersmay not handle all Unicode digit representations (e.g. non-ASCII numeric characters) consistently depending on regex options*.
Related documentation¶
Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with ** could not be confirmed; treat as unknown until verified.
Sources¶
SAIF.Business.Utilities/TitleCase.vbSAIF.Business.Utilities/SAIF.Business.Utilities.vbproj