PDA

View Full Version : Right() function as3?



artheus
September 16th, 2008, 03:26 AM
hey there.. I'm just wondering.. is there a function like right() or left() (in c/vb)..
where I can read small parts of a text.

Something like this:



var myString:String = "";

myString = "Hello World!";

trace(left(myString, 5)); //outputs the 5 first chars "Hello";

trace(right(myString, 6)); //outputs the 6 last chars "World!";


well.. the right starts from the right and reads to the left (as many chars as input. eg. 5 or 6 as in the example)

Cheers!

sekasi
September 16th, 2008, 03:33 AM
I'd suggest you perhaps try the documentation for the String class, since that has the answers..

artheus
September 16th, 2008, 03:45 AM
hehe okay.. I didn't look good enough ^^ Found the substr() eventually :D