Top
Back: 4.17.1 string declarations
Forward: 4.17.3 string type cast
FastBack: 4. Data types
FastForward: 5. Functions and system variables
Up: 4.17 string
Top: Singular 2-0-4 Manual
Contents: Table of Contents
Index: F. Index
About: About This Document

4.17.2 string expressions

A string expression is:

  1. a sequence of characters between two unescaped quotes (")
  2. an identifier of type string
  3. a function returning string
  4. a substring (using the bracket operator)
  5. a type cast to string (see string type cast)
  6. string expressions combined by the operation +.

Example:

 
// string_expression[start, length] : a substring
// (possibly filled up with blanks)
// the substring of s starting at position 2
// with a length of 4
string s="123456";
s[2,4];
→ 2345
"abcd"[2,2];
→ bc
// string_expression[position] : a character from a string
s[3];
→ 3
// string_expression[position..position] :
// a substring starting at the first position up to the second
// given position
s[2..4];
→ 2 3 4
// a function returning a string
typeof(s);
→ string

See Type conversion and casting; string type cast.


Top Back: 4.17.1 string declarations Forward: 4.17.3 string type cast FastBack: 4. Data types FastForward: 5. Functions and system variables Up: 4.17 string Top: Singular 2-0-4 Manual Contents: Table of Contents Index: F. Index About: About This Document
            User manual for Singular version 2-0-4, October 2002, generated by texi2html.