|
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 =)
(comments are locked)
|
|
Use string.Substring(). You use it like this: 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: and this would return Hope that helps! Klep Thanks a lot for a swift response! It works, I figured it should be simple but the Unity documentation about String only consist of "string" and "Length" so I couldn't find it xD
Mar 12 '12 at 10:41 AM
stevenp
Haha, yes pretty simple. Sometimes the docs won't have everything you need, so in that case, try looking in the msdn .NET libraries, because they'll most certainly have whatever you need in there. :) Glad I could help! Klep
Mar 12 '12 at 10:44 AM
Kleptomaniac
The Unity documentation only covers Unity; for all the Mono stuff you look in the .net or Mono docs (the Mono docs are a little more accurate but less complete).
Mar 12 '12 at 10:48 AM
Eric5h5
(comments are locked)
|
