Google

Go to the first, previous, next, last section, table of contents.


str_len, str_chr, sub_str

str_len(str)
:: Returns the length of a string.
str_chr(str,start,c)
:: Returns the position of the first occurrence of a character in a string.
sub_str(str,start,end)
:: Returns a substring of a string.
return
str_len(), str_chr():integer; sub_str():string
str,c
string
start,end
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 charater. 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


Go to the first, previous, next, last section, table of contents.