PDA

View Full Version : String Question


GoneNuts
04-22-2008, 01:47 PM
Hi people dose any one know how to search a string for first character?

E.g so if my string was "Hello" I would like to select the first character "H".

Also is there a way of knowing the amount of characters contained in the string?

Thanks People.

fitz
04-22-2008, 01:52 PM
You might want to read some documentation, cause these are pretty basic concepts.

length of string:
stringvar.length

first character in string:
stringvar.charAt(0);

amarghosh
04-22-2008, 01:54 PM
next time check this link before asking on forums: it will save u a lot of time

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/index.html

if u have:
var string:String = "hello";

string.charAt(0) will give u first char and so on.

string.length will give u the length

GoneNuts
04-22-2008, 02:47 PM
Thanks amarghosh