StringNormalizer provides several methods for normalizing strings.
More...
|
| trimBadChars ( $string) |
| Remove incomplete UTF-8 sequences from the beginning and end of the string.
|
|
| trimWhitespace ( $inputString) |
| Trim initial and trailing whitespace and control chars, and compress some internal control chars.
|
|
| cleanupToNFC ( $inputString) |
| Normalize string into NFC by using the cleanup method from UtfNormal.
|
|
| trimToNFC ( $inputString) |
| Do a cleanupToNFC after the string is trimmed.
|
|
|
| removeBadCharLast ( $string) |
| Remove bytes that represent an incomplete Unicode character at the end of string (e.g.
|
|
| removeBadCharFirst ( $string) |
| Remove bytes that represent an incomplete Unicode character at the start of string (e.g.
|
|
StringNormalizer provides several methods for normalizing strings.
- Copyright
- GPL-2.0-or-later
- Author
- Daniel Kinzler
-
John Erling Blad < jebla.nosp@m.d@gm.nosp@m.ail.c.nosp@m.om >
◆ cleanupToNFC()
Wikibase\Lib\StringNormalizer::cleanupToNFC |
( |
| $inputString | ) |
|
Normalize string into NFC by using the cleanup method from UtfNormal.
- Parameters
-
string | $inputString | The actual string to process. |
- Returns
- string
◆ removeBadCharFirst()
Wikibase\Lib\StringNormalizer::removeBadCharFirst |
( |
| $string | ) |
|
|
protected |
Remove bytes that represent an incomplete Unicode character at the start of string (e.g.
bytes of the char are missing)
- Todo
- this was stolen from the Language class. Make that code reusable.
- Parameters
-
- Returns
- string
◆ removeBadCharLast()
Wikibase\Lib\StringNormalizer::removeBadCharLast |
( |
| $string | ) |
|
|
protected |
Remove bytes that represent an incomplete Unicode character at the end of string (e.g.
bytes of the char are missing)
- Todo
- this was stolen from the Language class. Make that code reusable.
- Parameters
-
- Returns
- string
◆ trimBadChars()
Wikibase\Lib\StringNormalizer::trimBadChars |
( |
| $string | ) |
|
Remove incomplete UTF-8 sequences from the beginning and end of the string.
- Parameters
-
- Returns
- string
◆ trimToNFC()
Wikibase\Lib\StringNormalizer::trimToNFC |
( |
| $inputString | ) |
|
Do a cleanupToNFC after the string is trimmed.
- Parameters
-
- Returns
- string on NFC form
◆ trimWhitespace()
Wikibase\Lib\StringNormalizer::trimWhitespace |
( |
| $inputString | ) |
|
Trim initial and trailing whitespace and control chars, and compress some internal control chars.
- Parameters
-
string | $inputString | The actual string to process. |
- Returns
- string where whitespace possibly are removed.
The documentation for this class was generated from the following file: