Prev | Current Page 90 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

...
21 14 Fizz Snappers
As you can see, although exactly four space characters were supplied between each item, the columns
didn ??™ t line up very well. To fix this issue, the space characters can be replaced with the tab escaped
character \t , which makes the String declaration look more like this:
var myList:String = ???id\tqty\tname???;
This modification to the example aligns the resulting list so that the left - hand character for each column
will be correctly aligned with each other:
id qty name
1 22 Whizz Crackers
2 1 Snozz Bangers
....
21 14 Fizz Snappers
This functionality isn ??™ t guaranteed in all terminals, and indeed, some applications displaying output
from your haXe program may very well use a set number of space characters in place of a \t , but you
can see its usefulness.
Table 3 - 1 contains a list of the available escaped characters for the String data type.
Table 3 - 1
Escaped Character Name Description
\t Tab Aligns text to the next tabbed location
\n Newline Ends the preceding text and starts again from a
new line
\r Carriage return Similar to newline
\\ Backward slash Displays a backward slash
\??? Double quotes Displays double quotes in a string depicted by
double quotes
\??™ Single quote Displays a single quote in a string depicted by
single quotes
Chapter 3: Learning the Basics
35
Abstract Types
The abstract types, for want of a better name, are identifiers that cannot be represented in a literal
format.


Pages:
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102