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 Arithmetic Ops) 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 Numeric Data Types, for more information about creating matrices.
While strings can in principal store arbitrary content, most functions expect them to be UTF-8 encoded Unicode strings.
• Escape Sequences in String Constants: |
• Character Arrays: |
• Creating Strings: |
• Comparing Strings: |
• Manipulating Strings: |
• String Conversions: |
• Character Class Functions: |
© 1996–2020 John W. Eaton
Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions.
https://octave.org/doc/v5.2.0/Strings.html