Escaping characters: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 52: Line 52:
Tricky, isn't it?
Tricky, isn't it?
|-
|-
| '''Any number of percent symbols'''  || String s = "aaa%bbb"; ''or'' String s="aaa%%bbb"; || 97 97 97 37 98 98 98  or 97 97 97 37 37 98 98 98 || The string will be stored in memory exactly as you typed it in. Trouble may arise only if you decide to use that particular String as the first parameter of the ''String.Format'' or ''Display'' function.
| '''Any number of percent symbols'''  || String s = "aaa%bbb"; ''or'' String s="aaa%%bbb"; || 97 97 97 37 98 98 98  or 97 97 97 37 37 98 98 98 || The string will be stored in memory exactly as you typed it in. Trouble may arise only if you decide to use that particular String as the first parameter of the ''String.Format'' or ''Display'' function (read further).
|}
|}


Line 109: Line 109:
|-
|-
| aaa%%ddd || '''In Label.Text:''' aaa%%ddd<br>'''In Display:''' aaa%ddd || '''%''' is a special character meant for formatting Strings, as in ''String s = String.Format("The value of i is %d", i);''.<br>In Labels, it will have no effect. However the ''Display'' function works the same way as ''String.Format'', so if you want to display ''one'' percent symbol, you must have ''two'' in your string.
| aaa%%ddd || '''In Label.Text:''' aaa%%ddd<br>'''In Display:''' aaa%ddd || '''%''' is a special character meant for formatting Strings, as in ''String s = String.Format("The value of i is %d", i);''.<br>In Labels, it will have no effect. However the ''Display'' function works the same way as ''String.Format'', so if you want to display ''one'' percent symbol, you must have ''two'' in your string.
|-
| aaa%%bbb || aaa%bbb || A double percent in memory is rendered as a single percent on-screen
|}
|}


132

edits