Name

qbit::StringUtils - Functions to manipulate strings.

Functions

html_encode

Arguments:

  • $str - string.

Return value: string with encoded HTML entities.

html_decode

Arguments:

  • $str - string.

Return value: string with decoded HTML entities.

uri_escape

Arguments:

  • $str - string.

Return value: string with escaped URI entities.

check_email

Arguments:

  • $email - string, E-Mail.

Return value: boolean, TRUE if email is valid.

get_domain

Arguments:

  • $url - string, URL;

  • %opts - additional arguments:

    • ascii - boolean, convert unicode chars to ascii;

    • www - boolean, save 'www.'.

Return value: string if domain valid, else nothing.

to_json

Arguments:

  • $data - scalar.

Return value: string, $data as JSON.

from_json

Arguments:

  • $text - string, JSON.

Return value: scalar, perl structure from JSON.

format_number

Arguments:

  • $number - number;

  • %args - hash, additional arguments:

    • precision: number, needed precision, if missed then frac will return as is;

      thousands_sep: string, thousands separator, default gets from locale;

      decimal_point: string, decimal point, default gets from locale.

Return value: string, formatted number.