parrotcode: Utilities for string processing | |
Contents | Libraries |
String;Utils - Utilities for string processing
load_bytecode 'String/Utils.pbc'
.local pmc chomp
chomp = get_global ['String';'Utils'], 'chomp'
$S0 = chomp($S0) # use default record separator ("\n")
$S0 = chomp($S0, $S1) # use custom record separator
$S0 = chomp( $S1 )
$S0 = chomp( $S1, $S2 )
$S2
from tail of input string $S1
and return in $S0
. If $S2
is not specified, the default \n
is used.source
starting at pos
to an integer according to radix
. If pos
is specified, start converting at pos
, otherwise start from the beginning of the string. radix
may be either an integer radix (up to 36) or one of 'x', 'd', 'o', or 'b' to indicate a radix of 16, 10, 8, or 2.radix
. (result, len) = convert_string_to_int('101') # (101, 3)
(result, len) = convert_string_to_int('101', 2) # (5, 3)
(result, len) = convert_string_to_int('101', 8) # (65, 3)
(result, len) = convert_string_to_int('ff', 'x') # (255, 2)
convert_digits_to_string(source [, radix [, pos])
source
(offset by pos
) and according to radix
into its corresponding codepoint(s). Returns the converted codepoints and the number of source characters used in the conversion. Jerry Gay a.k.a. particle
Patrick Michaud <pmichaud@pobox.com>
|