text
Contains utility functions for dealing with text.
Methods:
capitalizeescape_html
mono
nbsp
nl2br
validate_unicode
Direct Link
capitalize
( text )Capitalizes the first character of a string.
Parameters
-
text
String
The string to capitalize.
Returns
StringThe capitalized string.
Direct Link
escape_html
( text )Replaces the following characters with their HTML entity counterparts: &, <, >, ", '.
Parameters
-
text
String
The string to modify.
Returns
StringThe modified string.
Direct Link
mono
( text )Replaces tabs, spaces, &, <, >, ", and ' with their HTML entity counterparts and newlines with linebreak HTML tags.
Parameters
-
text
String
The string to modify.
Returns
StringThe modified string.
Direct Link
nbsp
( text )Formats tabs and spaces into HTML that will display as intended.
Parameters
-
text
String
The string to modify.
Returns
StringThe modified string.
Direct Link
nl2br
( text )Replaces newlines with linebreak HTML tags.
Parameters
-
text
String
The string to modify.
Returns
StringThe modified string.
Direct Link
validate_unicode
( text )Strips invalid UTF-16 surrogate pairs.
Parameters
-
text
String
The string to validate.
Returns
StringThe validated string.