Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Lib\StringNormalizer Class Reference

StringNormalizer provides several methods for normalizing strings. More...

Public Member Functions

 trimBadChars (string $string)
 Remove incomplete UTF-8 sequences from the beginning and end of the string.
 
 trimWhitespace (string $inputString)
 Trim initial and trailing whitespace and control chars, and compress some internal control chars.
 
 cleanupToNFC (string $inputString)
 Normalize string into NFC by using the cleanup method from UtfNormal.
 
 trimToNFC (string $inputString)
 Do a cleanupToNFC after the string is trimmed.
 

Protected Member Functions

 removeBadCharLast (string $string)
 Remove bytes that represent an incomplete Unicode character at the end of string (e.g.
 
 removeBadCharFirst (string $string)
 Remove bytes that represent an incomplete Unicode character at the start of string (e.g.
 

Detailed Description

StringNormalizer provides several methods for normalizing strings.

Author
Daniel Kinzler
John Erling Blad < jebla.nosp@m.d@gm.nosp@m.ail.c.nosp@m.om >

Member Function Documentation

◆ cleanupToNFC()

Wikibase\Lib\StringNormalizer::cleanupToNFC ( string $inputString)

Normalize string into NFC by using the cleanup method from UtfNormal.

◆ removeBadCharFirst()

Wikibase\Lib\StringNormalizer::removeBadCharFirst ( string $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.

◆ removeBadCharLast()

Wikibase\Lib\StringNormalizer::removeBadCharLast ( string $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.

◆ trimBadChars()

Wikibase\Lib\StringNormalizer::trimBadChars ( string $string)

Remove incomplete UTF-8 sequences from the beginning and end of the string.

◆ trimToNFC()

Wikibase\Lib\StringNormalizer::trimToNFC ( string $inputString)

Do a cleanupToNFC after the string is trimmed.

◆ trimWhitespace()

Wikibase\Lib\StringNormalizer::trimWhitespace ( string $inputString)

Trim initial and trailing whitespace and control chars, and compress some internal control chars.


The documentation for this class was generated from the following file: