version 1.4, 2000/02/07 07:11:38 |
version 1.6, 2003/04/19 15:44:59 |
|
|
@comment $OpenXM: OpenXM/src/asir-doc/parts/builtin/string.texi,v 1.3 1999/12/21 02:47:34 noro Exp $ |
@comment $OpenXM: OpenXM/src/asir-doc/parts/builtin/string.texi,v 1.5 2000/03/02 07:46:14 noro Exp $ |
\BJP |
\BJP |
@node $BJ8;zNs$K4X$9$k1i;;(B,,, $BAH$_9~$_H!?t(B |
@node $BJ8;zNs$K4X$9$k1i;;(B,,, $BAH$_9~$_H!?t(B |
@section $BJ8;zNs$K4X$9$k1i;;(B |
@section $BJ8;zNs$K4X$9$k1i;;(B |
|
|
* strtov:: |
* strtov:: |
* eval_str:: |
* eval_str:: |
* strtoascii asciitostr:: |
* strtoascii asciitostr:: |
|
* str_len str_chr sub_str:: |
@end menu |
@end menu |
|
|
\JP @node rtostr,,, $BJ8;zNs$K4X$9$k1i;;(B |
\JP @node rtostr,,, $BJ8;zNs$K4X$9$k1i;;(B |
|
|
[2] asciitostr([256]); |
[2] asciitostr([256]); |
asciitostr : argument out of range |
asciitostr : argument out of range |
return to toplevel |
return to toplevel |
|
@end example |
|
|
|
\JP @node str_len str_chr sub_str,,, $BJ8;zNs$K4X$9$k1i;;(B |
|
\EG @node str_len str_chr sub_str,,, Strings |
|
@subsection @code{str_len}, @code{str_chr}, @code{sub_str} |
|
@findex str_len |
|
@findex str_chr |
|
@findex sub_str |
|
|
|
@table @t |
|
@item str_len(@var{str}) |
|
\JP :: $BJ8;zNs$ND9$5$rJV$9(B. |
|
\EG :: Returns the length of a string. |
|
@item str_chr(@var{str},@var{start},@var{c}) |
|
\JP :: $BJ8;z$,:G=i$K8=$l$k0LCV$rJV$9(B. |
|
\EG :: Returns the position of the first occurrence of a character in a string. |
|
@item sub_str(@var{str},@var{start},@var{end}) |
|
\JP :: $BItJ,J8;zNs$rJV$9(B. |
|
\EG :: Returns a substring of a string. |
|
@end table |
|
|
|
@table @var |
|
@item return |
|
\JP @code{str_len()}, @code{str_chr()}:$B@0?t(B; @code{sub_str()}:$BJ8;zNs(B |
|
\EG @code{str_len()}, @code{str_chr()}:integer; @code{sub_str()}:string |
|
@item str c |
|
\JP $BJ8;zNs(B |
|
\EG string |
|
@item start end |
|
\JP $BHsIi@0?t(B |
|
\EG non-negative integer |
|
@end table |
|
|
|
@itemize @bullet |
|
\BJP |
|
@item @code{str_len()} $B$OJ8;zNs$ND9$5$rJV$9(B. |
|
@item @code{str_chr()} $B$O(B @var{str} $B$N(B @var{start} $BHVL\$NJ8;z$+$i%9%-%c%s$7$F(B |
|
$B:G=i$K(B @var{c} $B$N:G=i$NJ8;z$,8=$l$?0LCV$rJV$9(B. $BJ8;zNs$N@hF,$O(B 0 $BHVL\$H$9$k(B. |
|
$B;XDj$5$l$?J8;z$,8=$l$J$$>l9g$K$O(B -1 $B$rJV$9(B. |
|
@item @code{sub_str()} $B$O(B, @var{str} $B$N(B @var{start} $BHVL\$+$i(B @var{end} $BHVL\(B |
|
$B$^$G$NItJ,J8;zNs$r@8@.$7JV$9(B. |
|
\E |
|
\BEG |
|
@item @code{str_len()} returns the length of a string. |
|
@item @code{str_chr()} scans a string @var{str} from the @var{start}-th |
|
character and returns the position of the first occurrence |
|
of the first character of a string @var{c}. Note that the top of a string |
|
is the 0-th charater. It returns -1 if the character does not appear. |
|
@item @code{sub_str()} generates a substring of @var{str} containing |
|
characters from the @var{start}-th one to the @var{end}-th one. |
|
\E |
|
@end itemize |
|
|
|
@example |
|
[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 |
@end example |
@end example |