comparison doc/interpreter/strings.txi @ 6556:8810bbf321ce

[project @ 2007-04-20 18:39:40 by jwe]
author jwe
date Fri, 20 Apr 2007 18:39:41 +0000
parents 5dde4dc2bcaf
children 49f0820425a8
comparison
equal deleted inserted replaced
6555:69e864d21c11 6556:8810bbf321ce
28 (@pxref{Arithmetic Ops}) but double-quote marks have no other purpose in 28 (@pxref{Arithmetic Ops}) but double-quote marks have no other purpose in
29 Octave, it is best to use double-quote marks to denote strings. 29 Octave, it is best to use double-quote marks to denote strings.
30 30
31 @cindex escape sequence notation 31 @cindex escape sequence notation
32 In double-quoted strings, the backslash character is used to introduce 32 In double-quoted strings, the backslash character is used to introduce
33 @deffn{escape sequences} that reresent other characters. For example, 33 @dfn{escape sequences} that reresent other characters. For example,
34 @samp{\n} embeds a newline character in a double-quoted string and 34 @samp{\n} embeds a newline character in a double-quoted string and
35 @samp{\"} embeds a double quote character. 35 @samp{\"} embeds a double quote character.
36 36
37 In single-quoted strings, backslash is not a special character. 37 In single-quoted strings, backslash is not a special character.
38 38
39 Here is an example showing the difference 39 Here is an example showing the difference
40 40
41 @example 41 @example
42 @group
42 toascii ("\n") 43 toascii ("\n")
43 @result 10 44 @result 10
44 toascii ('\n') 45 toascii ('\n')
45 @result [ 92 110 ] 46 @result [ 92 110 ]
47 @end group
46 @end example 48 @end example
47 49
48 You may also insert a single quote character in a single-quoted string 50 You may also insert a single quote character in a single-quoted string
49 by using two single quote characters in succession. For example, 51 by using two single quote characters in succession. For example,
50 52
51 @example 53 @example
52 'I can''t escape' 54 'I can''t escape'
53 @result I can't escape 55 @result I can't escape
54 @end example 56 @end example
55 57
56 Here is a table of all the escape sequences used in Octave. They are 58 Here is a table of all the escape sequences used in Octave. They are
57 the same as those used in the C programming language. 59 the same as those used in the C programming language.
58 60