Changes between Version 3 and Version 4 of Strings
- Timestamp:
- 01/14/14 12:18:41 (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Strings
v3 v4 48 48 49 49 Cobra allows usual escape sequences for control characters 50 \n, \r, \t, \0 50 * \a - alarm (bell/beep) 51 * \b - backspace 52 * \f - formfeed 53 * \n - newline. 54 * \r - carriage return. 55 * \t - tab. 56 * \v - vertical tab 57 * \\ - single \ 58 * \' - single quote ' 59 * \" - double quote " 60 * \0 - nul char. 51 61 {{{ 52 62 #!cobra … … 72 82 print 'Hi [customer.firstName] [customer.lastName]' 73 83 }}} 74 leading [ can be escaped '\[' to escape this substitution. 75 84 leading [ can be escaped '\[' to escape this substitution (individually). 85 86 The expression inside the [] may have an optional format descriptor following the expression and separated from it by a ':'[[BR]] 87 Any of the (.Net) single, standard or Custom format descriptors can be given.[[BR]] 88 (see [http://msdn.microsoft.com/en-us/library/system.iformattable%28v=vs.110%29.aspx IFormattable] interface) 89 {{{ 90 #!cobra 91 # std 92 x = 123.456 93 print 'val is [x] or [x:F4]' # val is 123.456 or 123.4560 94 95 x1=123 96 print 'val [x1] is [x1:D4]' # val [123] is 0123 97 print 'hex is 0x[x1:x4]' # hex is 0x007b 98 99 # custom 100 n=67263807 101 print 'PhoneNum is [n:00-0000-000]' # PhoneNum is 06-7263-807 102 #std datetime 103 d = DateTime() 104 print 'dflt is [d:F]' # dflt is Monday, 01 January 0001 00:00:00 105 }}} 76 106 77 107 Literal strings support the usual escape characters. 78 \n - newline. 79 \r - carriage return. 80 \t - tab. 81 \0 - nul char. 82 83 (arbitrary embedded hex or unicode ??) 108 * \a - alarm (bell/beep) 109 * \b - backspace 110 * \f - formfeed 111 * \n - newline. 112 * \r - carriage return. 113 * \t - tab. 114 * \v - vertical tab 115 * \\ - single \ 116 * \' - single quote ' 117 * \" - double quote " 118 * \0 - nul char. 119 120 (arbitrary embedded hex or unicode ??) 84 121 85 122 ==== Raw Strings ==== … … 94 131 95 132 Interprets escape chars but suppresses expression interpolation/substitution 96 ( handling of[])133 (expansion of expressions in []) 97 134 98 135 == !DocStrings == … … 105 142 {{{ 106 143 #!cobra 107 """ 108 Heres the doc string 109 """ 110 }}} 144 """ Heres a single line docString.""" 145 ... 146 """ 147 Heres a multiline doc string. 148 Second and subsequent lines follow 149 ... 150 """ 151 152 """ 153 Heres another single line docString. 154 """ 155 }}} 156 111 157 e.g. 112 158 {{{