String manipulation

Author: Adrián Pérez <aperez@udc.es>
Copyright: 2008-2009 Igalia S.L.
License:GPL3

Abstract

Provides common functions used to manipulate text strings.

Contents

string_upper

string_upper text

Converts a string to upper case.

string_lower

string_lower text

Converts a string to lower case.

string_length

string_length text

Obtains the length of a string.

string_startswith

string_startswith text prefix

Checks whether a string starts with a given prefix. Exit status is non-zero if the condition is not met.

string_endswith

string_endswith text suffix

Checks whether a string ends with a given suffix. Exit status is non-zero if the condition is not met.

string_ascii_code

string_ascii_code text [ format ]

Returns the ASCII code of the first character of the a string. Output is in decimal by default, but the behaviour can be changed by passing the format option, whose valid values are:

string_ascii

string_ascii text [ separator ] [ format ]

Returns ASCII codes for all characters in a string. Output is in decimal by default, but format can be changed using the same specifiers as for the string_ascii_code function. ASCII codes will be separated using the given separator string. You can pass an empty string to join the ASCII codes.

string_contains

string_contains text substring

Checks whether the given strings contains a substring inside it. Exit status is non-zero if the condition is not satisfied.

string_join

string_join separator [ string1 [ string2 ... [ stringN ] ] ]

Concatenates all given strings into a single one using the specified separator.

string_lstrip

string_lstrip

Removes blank characters from the start of lines of the given text. Works like a filter, using both standard input and output.

string_rstrip

string_rstrip

Removes blank characters from the end of lines of the given text. Works like a filter, using both standard input and output.

string_strip

string_strip

Removes blank characters both from the end and the start of lines given. Works like a filter, using both standard input and output.