StringTools - Maple Programming Help

Home : Support : Online Help : Programming : Names and Strings : StringTools Package : Constructors : StringTools/Iota

StringTools

 Iota
 generate string containing character ranges

 Calling Sequence Iota( n ) Iota( m .. n ) Iota( m, n )

Parameters

 m - positive integer or character n - positive integer or character

Description

 • The Iota procedure generates strings containing character ranges. Called with one argument n, a positive integer or a character, it generates the string consisting of those characters whose ASCII values are in the range $1..n$, inclusive. If n is a character (a string of length equal to one), it is equivalent to its ASCII value, given by the Ord procedure.
 • If Iota is called with two integer arguments (or two character arguments, again taken to be equivalent to their ASCII values), the character string consisting of the characters that fall numerically (in the ASCII character set) between those two values is generated.
 • The call Iota( m .. n ) is equivalent to Iota( m, n ).
 • When both m and n are specified, the numeric value of m must be less than or equal to n. Both m and n (or their ASCII numeric equivalent values) must be in the range $1..255$.
 • All of the StringTools package commands treat strings as (null-terminated) sequences of $8$-bit (ASCII) characters.  Thus, there is no support for multibyte character encodings, such as unicode encodings.

Examples

 > with( StringTools ):
 > length( Iota( 255 ) ); # Iota( 255 ) contains control characters
 ${255}$ (1)
 > Iota( 42 .. 56 );
 ${"*+,-./012345678"}$ (2)
 > Iota( 42, 56 );
 ${"*+,-./012345678"}$ (3)
 > Iota( "a" .. "z" );
 ${"abcdefghijklmnopqrstuvwxyz"}$ (4)
 > Iota( "a", "z" );
 ${"abcdefghijklmnopqrstuvwxyz"}$ (5)
 > Iota( "@", "@" );
 ${"@"}$ (6)

Maple returns an error if the numeric value of the first parameter m is greater than that of the second parameter n.

 > Iota( "z" .. "a" );