text

Contains utility functions for dealing with text.

Methods:

capitalize
escape_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

String
The capitalized string.

Direct Link

escape_html

( text )
Replaces the following characters with their HTML entity counterparts: &, <, >, ", '.

Parameters

  • text String
    The string to modify.

Returns

String
The 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

String
The 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

String
The modified string.

Direct Link

nl2br

( text )
Replaces newlines with linebreak HTML tags.

Parameters

  • text String
    The string to modify.

Returns

String
The modified string.

Direct Link

validate_unicode

( text )
Strips invalid UTF-16 surrogate pairs.

Parameters

  • text String
    The string to validate.

Returns

String
The validated string.