Mercurial > octave-nkf
comparison doc/interpreter/strings.txi @ 19630:0e1f5a750d00
maint: Periodic merge of gui-release to default.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 20 Jan 2015 10:24:46 -0500 |
parents | efd5cf93013b 446c46af4b42 |
children | 4197fc428c7d |
comparison
equal
deleted
inserted
replaced
19626:37d37297acf8 | 19630:0e1f5a750d00 |
---|---|
4 @c | 4 @c |
5 @c Octave is free software; you can redistribute it and/or modify it | 5 @c Octave is free software; you can redistribute it and/or modify it |
6 @c under the terms of the GNU General Public License as published by the | 6 @c under the terms of the GNU General Public License as published by the |
7 @c Free Software Foundation; either version 3 of the License, or (at | 7 @c Free Software Foundation; either version 3 of the License, or (at |
8 @c your option) any later version. | 8 @c your option) any later version. |
9 @c | 9 @c |
10 @c Octave is distributed in the hope that it will be useful, but WITHOUT | 10 @c Octave is distributed in the hope that it will be useful, but WITHOUT |
11 @c ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | 11 @c ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
12 @c FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | 12 @c FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
13 @c for more details. | 13 @c for more details. |
14 @c | 14 @c |
15 @c You should have received a copy of the GNU General Public License | 15 @c You should have received a copy of the GNU General Public License |
16 @c along with Octave; see the file COPYING. If not, see | 16 @c along with Octave; see the file COPYING. If not, see |
17 @c <http://www.gnu.org/licenses/>. | 17 @c <http://www.gnu.org/licenses/>. |
18 | 18 |
19 @node Strings | 19 @node Strings |
41 Since the single-quote mark is also used for the transpose operator | 41 Since the single-quote mark is also used for the transpose operator |
42 (@pxref{Arithmetic Ops}) but double-quote marks have no other purpose in Octave, | 42 (@pxref{Arithmetic Ops}) but double-quote marks have no other purpose in Octave, |
43 it is best to use double-quote marks to denote strings. | 43 it is best to use double-quote marks to denote strings. |
44 | 44 |
45 Strings can be concatenated using the notation for defining matrices. For | 45 Strings can be concatenated using the notation for defining matrices. For |
46 example, the expression | 46 example, the expression |
47 | 47 |
48 @example | 48 @example |
49 [ "foo" , "bar" , "baz" ] | 49 [ "foo" , "bar" , "baz" ] |
50 @end example | 50 @end example |
51 | 51 |
52 @noindent | 52 @noindent |
80 @result{} [ 92 110 ] | 80 @result{} [ 92 110 ] |
81 @end group | 81 @end group |
82 @end example | 82 @end example |
83 | 83 |
84 Here is a table of all the escape sequences used in Octave (within | 84 Here is a table of all the escape sequences used in Octave (within |
85 double quoted strings). They are the same as those used in the C | 85 double quoted strings). They are the same as those used in the C |
86 programming language. | 86 programming language. |
87 | 87 |
88 @table @code | 88 @table @code |
89 @item \\ | 89 @item \\ |
90 Represents a literal backslash, @samp{\}. | 90 Represents a literal backslash, @samp{\}. |
285 | 285 |
286 @example | 286 @example |
287 @group | 287 @group |
288 char ("orange", "green", "", "red") | 288 char ("orange", "green", "", "red") |
289 @result{} orange | 289 @result{} orange |
290 green | 290 green |
291 | 291 |
292 red | 292 red |
293 @end group | 293 @end group |
294 | 294 |
295 @group | 295 @group |
296 strvcat ("orange", "green", "", "red") | 296 strvcat ("orange", "green", "", "red") |
297 @result{} orange | 297 @result{} orange |
298 green | 298 green |
299 red | 299 red |
300 @end group | 300 @end group |
301 @end example | 301 @end example |
302 | 302 |
303 @item All string concatenation functions except @code{cstrcat} also accept cell | 303 @item All string concatenation functions except @code{cstrcat} also accept cell |
304 array data (@pxref{Cell Arrays}). @code{char} and | 304 array data (@pxref{Cell Arrays}). @code{char} and |
306 concatenates within the cells of the cell arrays: | 306 concatenates within the cells of the cell arrays: |
307 | 307 |
308 @example | 308 @example |
309 @group | 309 @group |
310 char (@{"red", "green", "", "blue"@}) | 310 char (@{"red", "green", "", "blue"@}) |
311 @result{} red | 311 @result{} red |
312 green | 312 green |
313 | 313 |
314 blue | 314 blue |
315 @end group | 315 @end group |
316 | 316 |
317 @group | 317 @group |
318 strcat (@{"abc"; "ghi"@}, @{"def"; "jkl"@}) | 318 strcat (@{"abc"; "ghi"@}, @{"def"; "jkl"@}) |
319 @result{} | 319 @result{} |
412 @example | 412 @example |
413 @group | 413 @group |
414 quote = ... | 414 quote = ... |
415 "First things first, but not necessarily in that order"; | 415 "First things first, but not necessarily in that order"; |
416 quote( quote == " " ) = "_" | 416 quote( quote == " " ) = "_" |
417 @result{} quote = | 417 @result{} quote = |
418 First_things_first,_but_not_necessarily_in_that_order | 418 First_things_first,_but_not_necessarily_in_that_order |
419 @end group | 419 @end group |
420 @end example | 420 @end example |
421 | 421 |
422 For more complex manipulations, such as searching, replacing, and | 422 For more complex manipulations, such as searching, replacing, and |