Skip to content

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

  1. Proper-case a string. ToProperCase calls VB.StrConv(Target, VbStrConv.ProperCase) and returns the result directly — no domain-specific word-list rules from Title-case a string are applied.
  2. Pad capital letters. ToPadCapitalLetters checks whether Target already contains a space.
  3. If it does: return Target unchanged. (BR-006)
  4. If it does not: delegate to (New PadCapitalLettersFormat).ApplyFormat(Target) to insert spaces before capital letters. PadCapitalLettersFormat is an external type not defined in this library; its formatting behavior could not be verified from this library's own source.**
  5. Convert an array to lowercase. ToLower(Target() As String) projects every element of the array through s.ToLower and returns a new array.
  6. Convert an array to uppercase. ToUpper(Target() As String) projects every element of the array through s.ToUpper and returns a new array.
  7. Check for numeric-only content. ContainsOnlyNumericCharacters returns True only when Target is not Nothing, 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.
  8. Sentence-case a string. ToSentenceCase branches on the length of Target:
  9. Nothing: return Nothing.
  10. Length 0: return Target unchanged.
  11. Length 1: return Target.ToUpper.
  12. 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

  • ToPadCapitalLetters never invokes the external PadCapitalLettersFormat type when the input already contains a space, so any behavior of that external type is exercised only on space-free input. (BR-006)
  • ToPadCapitalLetters does not null-check Target before calling Target.Contains(" "); a Nothing input would raise a NullReferenceException rather than being handled gracefully.**
  • ContainsOnlyNumericCharacters returns False (not an exception) for Nothing or blank input, distinguishing it from ToPadCapitalLetters's lack of a null guard.
  • ToSentenceCase is the only one of these five functions that explicitly handles a Nothing input by returning Nothing rather 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.

Sources

  • Business\SAIF.Business.Utilities\TitleCase.vb
  • Business\SAIF.Business.Utilities\mdlTextConversion.vb