SubString( string, from, to )
SubString
returns the substring of the string string that begins at
position from and continues to position to. The characters at these
two positions are included. Indexing is done with origin 1, i.e., the
first character is at position 1. from and to must be integers and
are both silently forced into the range 1..LengthString(string)
(see
LengthString). If to is less than from the substring is empty.
gap> SubString( "Hello world.\n", 1, 5 ); "Hello" gap> SubString( "Hello world.\n", 5, 1 ); ""
Because strings are now lists, substrings can also be extracted with
string{[from..to]}
(see List Elements). SubString
forces
from and to into the range 1..Length(string)
, which the above
does not, but apart from that SubString
is obsolete.
GAP 3.4.4