Text and array case-conversion utilities¶
This operation groups five small, single-purpose string and array helper functions that supplement Title-case a string: proper-casing via the .NET built-in converter, capital-letter padding, array-level upper/lower casing, a numeric-only character check, and sentence-casing. Each is a thin, largely unconditional transformation with at most one branch, so they are documented together rather than as five separate operation pages.
| Field | Value |
|---|---|
| Operation ID | OP-BU-03 |
| Trigger | Caller calls any of Target.ToProperCase(), Target.ToPadCapitalLetters(), Target().ToLower(), Target().ToUpper(), Target.ContainsOnlyNumericCharacters(), or Target.ToSentenceCase() |
| Inputs | Target As String (most functions) or Target() As String (array case-conversion) |
| Outputs | Transformed String, transformed String(), or Boolean (for ContainsOnlyNumericCharacters) |
| Primary components | TitleCaseExtensions.ToProperCase, TitleCaseExtensions.ToPadCapitalLetters, TitleCaseExtensions.ToLower, TitleCaseExtensions.ToUpper, TitleCaseExtensions.ContainsOnlyNumericCharacters, mdlTextConversion.ToSentenceCase |
| Entry point | Business\SAIF.Business.Utilities\TitleCase.vb, Business\SAIF.Business.Utilities\mdlTextConversion.vb |
Steps¶
- Proper-case a string.
ToProperCasecallsVB.StrConv(Target, VbStrConv.ProperCase)and returns the result directly — no domain-specific word-list rules from Title-case a string are applied. - Pad capital letters.
ToPadCapitalLetterschecks whetherTargetalready contains a space. - If it does: return
Targetunchanged. (BR-006) - If it does not: delegate to
(New PadCapitalLettersFormat).ApplyFormat(Target)to insert spaces before capital letters.PadCapitalLettersFormatis an external type not defined in this library; its formatting behavior could not be verified from this library's own source.** - Convert an array to lowercase.
ToLower(Target() As String)projects every element of the array throughs.ToLowerand returns a new array. - Convert an array to uppercase.
ToUpper(Target() As String)projects every element of the array throughs.ToUpperand returns a new array. - Check for numeric-only content.
ContainsOnlyNumericCharactersreturnsTrueonly whenTargetis notNothing, its trimmed length is greater than zero, and a regex match for a non-digit character (\D) finds no matches — i.e., every character in the (untrimmed) string is a digit. - Sentence-case a string.
ToSentenceCasebranches on the length ofTarget: Nothing: returnNothing.- Length 0: return
Targetunchanged. - Length 1: return
Target.ToUpper. - Length 2+: return the first character uppercased concatenated with the remaining characters lowercased.
Process flow¶
The following diagram visualizes the independent branches for each of the five helper functions.
flowchart TD
Start([Caller invokes a helper function]) --> Which{Which function?}
Which -->|ToProperCase| Proper[StrConv ProperCase] --> DoneProper([Return proper-cased string])
Which -->|ToPadCapitalLetters| PadCheck{Target contains a space?}
PadCheck -->|Yes| PadSkip([Return Target unchanged])
PadCheck -->|No| PadFormat[Delegate to external<br>PadCapitalLettersFormat.ApplyFormat]
PadFormat --> DonePad([Return padded string])
Which -->|ToLower array| ArrLower[Project each element ToLower] --> DoneLower([Return new lowercase array])
Which -->|ToUpper array| ArrUpper[Project each element ToUpper] --> DoneUpper([Return new uppercase array])
Which -->|ContainsOnlyNumericCharacters| NumCheck{Not Nothing, trimmed<br>length greater than 0,<br>no non-digit match?}
NumCheck -->|Yes| NumTrue([Return True])
NumCheck -->|No| NumFalse([Return False])
Which -->|ToSentenceCase| SentLen{Target length?}
SentLen -->|Nothing| SentNothing([Return Nothing])
SentLen -->|0| SentEmpty([Return unchanged])
SentLen -->|1| SentOne([Return uppercased])
SentLen -->|2+| SentMulti([Return first char uppercased<br>plus remainder lowercased])
Failure and edge-case behavior¶
ToPadCapitalLettersnever invokes the externalPadCapitalLettersFormattype when the input already contains a space, so any behavior of that external type is exercised only on space-free input. (BR-006)ToPadCapitalLettersdoes not null-checkTargetbefore callingTarget.Contains(" "); aNothinginput would raise aNullReferenceExceptionrather than being handled gracefully.**ContainsOnlyNumericCharactersreturnsFalse(not an exception) forNothingor blank input, distinguishing it fromToPadCapitalLetters's lack of a null guard.ToSentenceCaseis the only one of these five functions that explicitly handles aNothinginput by returningNothingrather than throwing or returning an empty string.- None of these five functions apply the word-list, prefix, or suffix rules used by Title-case a string (BR-001, BR-003, BR-004, BR-005); they are simpler, independent transformations.
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.
Related documentation¶
Sources¶
Business\SAIF.Business.Utilities\TitleCase.vbBusiness\SAIF.Business.Utilities\mdlTextConversion.vb