str)indexevaluation!strings
str)
return an integer, respectively a rational as represented by the string
str.
Int returns fail if non-digit characters occur in str.
For Rat, the argument string may start with the sign character '-',
followed by either a sequence of digits or by two sequences of digits
that are separated by one of the characters '/' or '.',
where the latter stands for a decimal dot.
(The methods only evaluate numbers but do not perform arithmetic!)
gap> Int("12345")+1;
12346
gap> Int("123/45");
fail
gap> Int("1+2");
fail
gap> Int("-12");
-12
gap> Rat("123/45");
41/15
gap> Rat( "123.45" );
2469/20
Ordinal( n ) F
returns the ordinal of the integer n as a string.
gap> Ordinal(2); Ordinal(21); Ordinal(33); Ordinal(-33); "2nd" "21st" "33rd" "-33th"
[Top] [Previous] [Up] [Next] [Index]
GAP 4 manual