[back] [prev] [next] [index] [root]

 


SScan

Reads kash objects out of a string.

Syntax:

L := SScan( s, fmt, R1, R2, ...);

list
  L  
containing the kash objects
string
  s  
string
  fmt  
format string
rings
  R1, R2  

See also:  SPrint, SScan

Description:

Supported kash objects are: integers ( \%Z), reals ( \%R), logicals ( \%B), polynomials ( \%P) and algebraic elements ( \%E); also the usual standard C-format is supported. If you want to scan an algebraic element resp. a polynomial you have to pass the order resp. the polynomial algebra as parameter to the SScan function. For a better understanding see the detailed list of examples below.


Example:

reading a list of integers

kash> L := SScan("111, 12, 13","%Z,%Z,%Z");
[ 111, 12, 13 ]



Example:

reading an algebraic element

kash> o := OrderMaximal(Z,2,5);;
kash> L := SScan("alpha: [0,27]/12 ","alpha: %E",o);
[ [0, 9] / 4 ]



Example:

or

kash> L := SScan("alpha: [0,27]/12 ","%s %E",o);
[ "alpha:", [0, 9] / 4 ]



Example:

reading a logical and a polynomial and a real

kash> s := "true, 17*x^3 + 14*x +2, 2.1382";;
kash> fmt := "%B,%P,%R";;
kash> L := SScan(s, fmt, Zx);
[ true, 17*x^3 + 14*x + 2, 2.1382 ]



Example:

and now an interesting example

kash> s := "foobar : foobar 17*x^3 + 14*x +2, 2.1382";;
kash> fmt := "%s : %s %P,%R";;
kash> L := SScan(s, fmt, Zx);
> [ "foobar", "foobar", 17*x^3 + 14*x + 2, 2.1382 ]


<- back[back] [prev] [next] [index] [root]