How to turn a String to an Int?

Unity3D 2012. 10. 11. 16:36
반응형

How to turn a String to an Int?

1

I need to change a string into an integer. I know there is ToString() but is there something like ToInt()?

more ▼

asked Dec 12 at 12:01 AM

ChimpKing\'s gravatar image

ChimpKing 
100  12  17  24


2 answers:sort voted first 
5

parseInt (JS only), int.Parse (JS + C#), int.TryParse (JS + C#).

more ▼

answered Dec 12 at 12:38 AM

Eric5h5\'s gravatar image

Eric5h5 
65.9k  37  109  465

this is not in the reference files provided by Unity. Is this normally common knowledge? It certainly wasn't to me, but I'm new to script.

Dec 21 at 07:03 PMdissidently
1

Try:

var urInt: int = System.Int32.Parse(urText); print(urInt);

반응형
: