Make smart financial decisions with DailyFinance

String Cheatsheet

string

I use a ton of string tricks, I concatenate graphic names, do search and replaces on homemade HTML tags in XML attributes (cause you can’t use CDATA in attributes) strings are definately my lazy crutch,  they work, easy to debug  and like I said..I’m occassionally a lazy coder.

Even though I use them alot here’s are some of the string things that I occassionally forget, and perhaps I’m not the only one. Consider this your string cheatsheet:


in no particular order of usefulness:

Take any numeric string — like “5” subtract 0 from it, and the result is a Number (and yes I realize there are at least 7  different ways of doing this..but this one is kind of intresting).

Flash doesn’t care from single or double quotes, but if you use doubles and you need to nest them you can escape the with a forward slash.

To find out how many words are in a string, simply split it using a space as a delimiter and return the length.

\r and \n insert new lines in strings

\t is a tab which is fairly useless unless you also utilize <TEXTFORMAT>

while we’re mentioning  <TEXTFORMAT> here’s a list of all the tags for that

<TEXTFORMAT //textfieldoptions with following attributes
BLOCKINDENT=”10” //distance from left border
INDENT=”10” //distance of first line from left
LEADING=”10” //lineheight
LEFTMARGIN=”10” //distance from left border
RIGHTMARGIN=” 15” //distance from right border
TABSTOPS=”10,100,1000”> //list of tabstop positions from left border


HTML lists are usefull, just remember that you don’t need UL tags
<LI> //new paragraph with a bullet point
If your exporting to Flash 6 your bullets are gonna be black, only solution I’ve found is to use the color object on the whole textblock, which pretty much sucks.

Also a real bugger of a HTML bug
<b>This is a</b> <i>BUG</i> will render without the space between ‘a’ and ‘BUG’ here’s a tasty solution to fix this

So what’s you favorite string trick?

News
Macromedia (141)
Innovation (164)
Merger (41)
Releases (65)
WIN Business (24)
Events
MAX (26)
FlashForward (8)
MMUGs (16)
Webinars (4)
Learning
ActionScript (49)
Designer Certification (5)
Developer Certification (6)
Ideas (163)
Links (83)
Samples (57)
Tips and Tricks (98)
Tutorials (45)
Design & Development
Accessibility (14)
Ad Design (27)
Art (94)
Components (6)
Extensions (17)
Games (65)
Rich Internet Applications (99)
Sound (38)
Video (65)
Web Standards (33)
Software
Flash 8 (103)
Flash MX2004 (92)
Flash Paper 2 (3)
Flash Player 8 (55)
Flash MX2004 Professional (44)
Flash Lite (24)
Flash Platform (91)
Flash Remoting (3)
Flash Communications Server MX (8)
Flash Video (24)
Flash Paper (3)
Macromedia Contribute (2)
Macromedia Flex (8)
8Ball (15)
Maelstrom (19)
Software Updates (34)
Beta (22)
Bugs (14)
Studio 8 (25)

RESOURCES

RSS NEWSFEEDS

Powered by Blogsmith

Other Weblogs Inc. Network blogs you might be interested in: