You can do this using the htmlEscape
method:
var escapedStr : String = StringTools.htmlEscape(???String to display???);
Again, you can reverse the effects of this method using the htmlUnescape method:
var normalStr : String = StringTools.htmlUnescape(escapedStr);
The StringBuf Class
The StringBuf class provides the developer with a clean way of constructing strings from much smaller
strings and characters.
Table 3 - 12 details the methods contained in the StringBuf class.
Table 3-12
StringBuf Method Description
add(?x : Dynamic) : Void Adds a string representation of an object to the
StringBuf string
addChar(c : Int) : Void Adds a character from an ASCII code to the
StringBuf string
addSub(s : String, pos : Int,
?len : Int) : Void
Adds a section of a string from a given location and
length to the StringBuf string
toString() : String Returns the string contained in the StringBuf object
Part I: The Core Language
72
The StringBuf class must be instantiated before you can use it:
var myString : StringBuf = new StringBuf();
Once the StringBuf class is instantiated, you can then append your smaller strings to the StringBuf
object using the add method.
Pages:
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175