The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

String::Rexx - Perl implementation of Rexx string functions

SYNOPSIS

  use String::Rexx qw( :all );

  use String::Rexx qw( functions... );

DESCRIPTION

This module implements almost all string functions of regina2-rexx .

Abbrev( 'long', 'short' [, len] )
 Return 1 if string $short is a shortcut for string $long. And optionally, $len
 must not be greater than what the number of charecters matched with string $shoft. 
 Otherwise, return 0.
countstr( 'pat', 'string' )
 Counts the number of occurences  of 'pat' within 'string'
center( 'string' , len [, char ] )
 Returns a string of length len, with the proper padding so that 'string' is centered
changestr( 'old', 'string' , 'new' )
 Changes all instances of substing 'old' inside 'string' to the new string 'new'
compare( 'string1' , 'string2' [, char ] )
 Returns 0 when both strings are equal, or N when they are not. 
 The number N denotes the length of either string -- strings are always 
 compared after padding, so they always have equal length when they are compared. 
 If the comparison fails, and the string contents are unequal, it will 
 return N, the size of either string since by now hey both have the same length.  
 The default pad character is space , ' ' .
copies( 'string' , N )
 Returns a string consisting of N concatenated copies. N = 0, 1, 2, ...
delstr( 'string' , start [,length] )
 Deletes the substring which starts at $start.  
 Length defaults to the rest of string.
delword( 'string' , start [,length] )
 Deletes $length words, starting from $start.  
 Length defaults to the rest of string.
errortext( N )
 Returns the error string that describes the error number N .
datatype( 'string' [, option ] )
 When 'string' represents a number or a non-number literal, this fuction 
 returns 'NUM' or 'LIT', respectively. 
 Option can be either 'NUM' or 'LIT'; when specified, the fuction returns 1 (true) or
 0 (false) depending whether 'string' is a NUM or a LIT .
 If the user-supplied option is neither NUM or LOT, the return value is set to undef ;
d2c( N )
 Same as chr(N) . Converts decimal N to its char in the character set. 
d2x( N [, length] )
 Converts decimal N to a hex string of size $lenght .
insert( 'source' , 'target' [,'position' ] [,'length'] [, char ] )
 Inserts string 'source' into string 'targer'. 
 Position defaults to 0, length defaults to len of $source , and 
 padding char defaults to ' ' .
lastpos( 'needle' , 'haystack', [, start ] )
 Returns the position of $needle in $haystack (searching from the end) . 
 Returns 0 if not found, and 1 when neelde occurs at start of haystack
left( 'string' , length, [, 'char'] )
  Returns the leftmost $length chars. If there are not
  enough characters, the string is padded (prepended) with char characters.
  Char defaults to space.
Length( 'string' )
 Returns the length of string.
overlay( 'source', 'target' [, start] [, length] [, pad] )
 Overstrikes the $target string, with $source .
Reverse( 'string' )
  Reverses the order of characters in string.
Pos( 'needle' , 'haystack', [, start ] )
 Returns the position of $needle in $haystack . 
 Returns 0 if not found, and 1 when neelde occurs at start of haystack
right( 'string' , length, [, 'char'] )
  Returns the $length chars from the end of string. If there are not
  enough characters, the string is padded (prepended) with char characters.
  Char defaults to space.
space( 'string' [, 'length'] [, 'char'] )
  After removing leading and trailing spaces, internal whitespace
  change to $length chars. Char defaults to  ' ' , and length defaults to 1 .
strip( 'string' [, 'Option'] [, 'char'] )
  Strips leading whitespace from string.
  The optional 2nd param can be set to 'leading', 'trailing', or 'both' .
  The optional 3rd param will strip chars instead of whitespace.
  Returns the striped string.
Substr( 'string', start, [, length ] [, padchar ] )
  Returns a substring of string. If string does not have enough chars
  to fill the request, we use padding with character padchar .
wordindex( 'string', N )
  Returns the index in the string for the Nth word.
wordlength( 'string', N )
  Returns the length of the Nth word in the string. Where N=1,2,...
  Returns 0 if there are less worlds than N .
  Raises exception if is  N < 1
subword( 'string', start [, N ] )
  Returns a string of words staring from start. N denotes how many
  words to return (default is as many as possible.)
  start = N = 1,2,...
translate( 'string' [, 'new' , 'old' [, pad] ] )
  The translitaration oparator. It returns a strings where all characters 
  in 'old' and transformed to the corresponding characters in 'new' .
  In the special case when all options are absent, it translates $string
  to upper case.
verify( 'string', 'chars' [, sense] [, start] )
 Returns 0 if $string consists from characters in the set $chars , otherwise
 it returns the position of the 1st character in $sting that failed the match.
 The sense param is either 'M' for match, or 'N' for non-match, default is 'M' .
 The start param indicate the position from 'string' to start matching (default is 1,
 to match from the start of 'string').
wordpos( 'pattern' , 'string' )
 Returns the position of the word in 'string' containing  'pattern'
word( 'string', wordno )
  Returns the nth  word in the string.
words( 'string' )
  Returns the number of words in the string.
xrange( S , E )
  Retruns a sequence of characters, starting with char S, and ending with char E .

EXPORT

None by default.

AUTHOR

Ioannis Tambouras, <ioannis@earthlink.net>

SEE ALSO

regina(1).