[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
5. Strings
A string constant consists of a sequence of characters enclosed in either double-quote or single-quote marks. For example, both of the following expressions
"parrot" 'parrot' |
represent the string whose contents are ‘parrot’. Strings in Octave can be of any length.
Since the single-quote mark is also used for the transpose operator (see section Arithmetic Operators) but double-quote marks have no other purpose in Octave, it is best to use double-quote marks to denote strings.
Strings can be concatenated using the notation for defining matrices. For example, the expression
[ "foo" , "bar" , "baz" ] |
produces the string whose contents are ‘foobarbaz’. See section Numeric Data Types, for more information about creating matrices.
5.1 Escape Sequences in string constants | ||
5.2 Character Arrays | ||
5.3 Creating Strings | ||
5.4 Comparing Strings | ||
5.5 Manipulating Strings | ||
5.6 String Conversions | ||
5.7 Character Class Functions |