Home Online Manual
Top
Back: string type cast
Forward: string related functions
FastBack: ring
FastForward: vector
Up: string
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

4.19.4 string operations

+
concatenation

<=, >=, ==, <>
comparison (lexicographical with respect to the ASCII encoding)

string_expression [ int_expression ]
is a character of the string; the index 1 gives the first character.

string_expression [ int_expression, int_expression ]
is a substring, where the first argument is the start index and the second is the length of the substring, filled up with blanks if the length exceeds the total size of the string

string_expression [ intvec_expression ]
is a expression list of characters from the string


Example:

 
  string s="abcde";
  s[2];
==> b
  s[3,2];
==> cd
  ">>"+s[1,10]+"<<";
==> >>abcde     <<
  s[2]="BC"; s;
==> aBcde
  intvec v=1,3,5;
  s=s[v]; s;
==> ace
  s="654321"; s=s[3..5]; s;
==> 432