Sentence-case a string¶
Normalizes a string to sentence case: first character upper case, remainder lower case.
| Field | Value |
|---|---|
| Operation ID | op-04-sentence-case |
| Trigger | Caller normalizes a string for sentence-style display |
| Inputs | String value |
| Outputs | Sentence-cased string |
| Primary components | mdlTextConversion.ToSentenceCase |
| Entry point | SAIF.Business.Utilities/mdlTextConversion.vb |
Steps¶
- Return
Nothingwhen the target isNothing. - Return the value unchanged when length is 0.
- Upper-case it when length is 1.
- Otherwise upper-case the first character and lower-case the remainder (BR-017).
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([Caller invokes ToSentenceCase]) --> CheckNothing{Target is Nothing?}
CheckNothing -->|Yes| ReturnNothing([Return Nothing])
CheckNothing -->|No| CheckLen0{Length = 0?}
CheckLen0 -->|Yes| ReturnUnchanged([Return value unchanged])
CheckLen0 -->|No| CheckLen1{Length = 1?}
CheckLen1 -->|Yes| UpperOnly([Upper-case the character])
CheckLen1 -->|No| UpperFirst["Upper-case first character,<br>lower-case remainder"]
ReturnNothing --> Done([Return result])
ReturnUnchanged --> Done
UpperOnly --> Done
UpperFirst --> Done
Failure and edge-case behavior¶
- No exceptions are raised.
Nothinginput returnsNothing, zero-length input is returned unchanged, and single-character input is upper-cased without lower-casing any remainder.
Related documentation¶
Sources¶
SAIF.Business.Utilities/mdlTextConversion.vb