Hi guys! I’m sorry if the question is a bit unclear since I don’t know how should I put it.
Basically it’s should be something simple, I just want to get the first “x” numbers from a string and turn them into a new string. For example, I have a string “unity”, I want to get the first 2 characters from the string so the new string should be “un”. Thank you in advance =)
Use string.Substring(). You use it like this:
var oldString : String = "unity";
var newString : String = "";
newString = oldString.Substring(x, y);
x being the character index you wish to begin your SubString at, and y being the length of characters you want the Substring to be. So in your case it would be:
newString = oldString.Substring(0, 2);
and this would return
newString = "un".
Hope that helps! Klep