TitleCase¶
TitleCase is a static utility class that converts free-text strings to title case, applying domain-specific abbreviation and exception handling (insurance/legal entity suffixes, directional abbreviations, state codes, mixed-case names, numeric suffixes).
Purpose¶
- Convert an input string to title case using configured word-list rule tables rather than a naive per-word capitalization algorithm.
Context¶
- Namespace:
SAIF.Business.Utilities - Assembly/package:
SAIF.Business.Utilities(NuGet packageSAIF.BOF.Business.Utilities)
Public members¶
| Member | Signature | Purpose |
|---|---|---|
| ToTitleCase | Public Shared Function ToTitleCase(inString As String) As String |
Splits the input string into words on non-alphanumeric boundaries, classifies each word against configured casing rule tables, reassembles the string preserving original delimiter characters, and applies an exact-suffix list (e.g., possessive 's) as a final pass. |
Behavioral notes¶
- Word classification uses private shared rule tables:
UpperCaseWordList(e.g., "SAIF", "LLC", "MD" — always rendered uppercase),MixedCaseWordList(e.g., "PhD", "LaCombe" — rendered per an exact mixed-case mapping),LowerCaseWordList(e.g., "is", "in", "the" — minor words always rendered lowercase),MixedCasePrefixList(e.g., "Mc", "O'" — mixed-case name prefixes),MixedCaseSuffixList, andNumberSuffixes(e.g., "1st", "2nd" — numeric ordinal suffix handling). - Private helper methods
ReassembleString(2 overloads),TitleCaseSingleWord,ApplyExactSuffixList,HasNumberSuffix, andGetNumberSuffixPartsimplement the internal word-processing pipeline; they are not callable outside this class. - See BR-001 for the fixed-case rendering rule enforced by this class.
- The class holds no public or private instance state — all members are
Shared, making calls stateless and thread-safe with respect to instance data.*
Constraints and usage notes¶
- Consumers should call
ToTitleCasedirectly, or via the equivalentString.ToTitleCase()extension method defined inTitleCaseExtensions, which simply forwards to this method. - The word-list rule tables are fixed at compile time; there is no runtime configuration mechanism to add or remove abbreviation entries.*
Note: Statements marked with
*are inferred from code behavior rather than explicit documentation or comments.
Sources¶
Business\SAIF.Business.Utilities\TitleCase.vb