[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
6.10.1 rtostr | ||
6.10.2 strtov | ||
6.10.3 eval_str | ||
6.10.4 strtoascii , asciitostr | ||
6.10.5 str_len , str_chr , sub_str |
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
rtostr
:: Convert obj into a string.
string
arbitrary
strtov()
for inverse conversion from string to indeterminate.
[0] A=afo; afo [1] type(A); 2 [2] B=rtostr(A); afo [3] type(B); 7 [4] B+"1"; afo1
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
strtov
:: Convert a string str into an indeterminate.
intederminate
string which is valid to constitute an indeterminate.
[0] A="afo"; afo [1] for (I=0;I<3;I++) {B=strtov(A+rtostr(I)); print([B,type(B)]);} [afo0,2] [afo1,2] [afo2,2]
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
eval_str
:: Evaluates a string str.
object
string which can be accepted by Asir parser
rtostr()
.
[0] eval_str("1+2"); 3 [1] fctr(eval_str(rtostr((x+y)^10))); [[1,1],[x+y,10]]
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
strtoascii
, asciitostr
:: Converts a string into a sequence of ASCII codes.
:: Converts a sequence of ASCII codes into a string.
strtoascii()
:list; asciitostr()
:string
string
list containing positive integers less than 256.
strtoascii()
converts a string into a list of integers
which is a representation of the string by the ASCII code.
asciitostr()
is the inverse of asciitostr()
.
[0] strtoascii("abcxyz"); [97,98,99,120,121,122] [1] asciitostr(@); abcxyz [2] asciitostr([256]); asciitostr : argument out of range return to toplevel
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
str_len
, str_chr
, sub_str
:: Returns the length of a string.
:: Returns the position of the first occurrence of a character in a string.
:: Returns a substring of a string.
str_len()
, str_chr()
:integer; sub_str()
:string
string
non-negative integer
str_len()
returns the length of a string.
str_chr()
scans a string str from the start-th
character and returns the position of the first occurrence
of the first character of a string c. Note that the top of a string
is the 0-th character. It returns -1 if the character does not appear.
sub_str()
generates a substring of str containing
characters from the start-th one to the end-th one.
[185] Line="123 456 (x+y)^3"; 123 456 (x+y)^3 [186] Sp1 = str_chr(Line,0," "); 3 [187] D0 = eval_str(sub_str(Line,0,Sp1-1)); 123 [188] Sp2 = str_chr(Line,Sp1+1," "); 7 [189] D1 = eval_str(sub_str(Line,Sp1+1,Sp2-1)); 456 [190] C = eval_str(sub_str(Line,Sp2+1,str_len(Line)-1)); x^3+3*y*x^2+3*y^2*x+y^3
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] |
This document was generated on December 22, 2024 using texi2html 5.0.