Class TextModeCharacters
The characters of a text as MS-VBA's text mode matches them, in Like (MS-VBAL §5.6.9.6) and in a search - InStr,
InStrRev, Replace, Split, Filter: folded to one case, and four characters as the two letters they expand to.
public static class TextModeCharacters
- Inheritance
-
TextModeCharacters
- Inherited Members
Remarks
This is not how the relational operators compare in text mode (Compare(ReadOnlySpan<char>, ReadOnlySpan<char>)):
MS-VBA's = compares by the regional collation, which ignores width and kana and expands more, where its Like and its searches fold case and
expand æ, œ, ß and þ, and nothing else (recorded in Excel: oracle\like-collation, oracle\instr-text). A soft hyphen, a full-width
letter, katakana, an accented letter and the Kelvin sign are characters of their own; ij, the ligatures ff to st, dž and ẞ
are not expanded.
Methods
Expansion(char)
The two letters text mode matches a folded character as, if it is one MS-VBA expands: æ, œ, ß and þ, which the capitals
Æ, Œ and Þ fold to.
public static string? Expansion(char folded)
Parameters
foldedcharA character, folded (Fold(char, TextInfo)).
Returns
Fold(char, TextInfo)
The character a character matches in text mode: its lowercase in the regional settings, where the uppercase of that lowercase is the character again.
public static char Fold(char c, TextInfo textInfo)
Parameters
Returns
Remarks
A case mapping that does not go both ways is not a difference in case: the Kelvin sign (U+212A) lowercases to k, which uppercases to K, so
it matches no k, as in MS-VBA. Accents are not case. The regional settings decide what the case of a letter is: in Turkish, İ is the capital
of i.
Letters(ReadOnlySpan<char>, TextInfo, out int[])
The letters of a text in text mode: each character folded, and each that is expanded as its letters.
public static string Letters(ReadOnlySpan<char> text, TextInfo textInfo, out int[] characterOf)
Parameters
textReadOnlySpan<char>The text.
textInfoTextInfoThe casing of the regional settings.
characterOfint[]For each letter, the index in
textof the character it is part of.
Returns
- string
The letters.