I'm trying to cut the first part of a sring off. In the actionscipt help it mentioned this slice funcion but I can't seem to get it to work. Any tricks or ideas?
Thanks
Printable View
I'm trying to cut the first part of a sring off. In the actionscipt help it mentioned this slice funcion but I can't seem to get it to work. Any tricks or ideas?
Thanks
I prefer to use the string.substr() or string.substring() functions. for string.substring() The first number is the start index, the last number is the end index. For string.substr() it the index of the first char and how many to take from there
Hard to explain so Ill give an example:
orCode:myStr = "Have a nice day!";
a = myStr.substring(0,4);
b = myStr.substring(5,6);
c = myStr.substring(7,11);
d = mystr.substring(12);
trace("a = " + a);
trace("b = " + b);
trace("c = " + c);
trace("d = " + d);
Give the same result.Code:myStr = "Have a nice day!";
a = myStr.substr(0,4);
b = myStr.substr(5,1);
c = myStr.substr(7,4);
d = mystr.substr(12);
trace("a = " + a);
trace("b = " + b);
trace("c = " + c);
trace("d = " + d);
They work a little diffrently so try them out and see wich one is best for you.
Thanks etcettra,
That works great! Appreciate the help.
Thanks etcettra,
That works great! Appreciate the help.