How to get int values from a string?

I have a string, which contains numbers that interest me. There is 16 of such numbers, divided with “_” symbol. How to get them? Thanks!

P.S. I was thinking about converting this string into char array and than use foreach, but how to seperate them?

You can use String.Split() to split the numbers, and then int.Parse to parse them from strings.
Basically:

var myString:String;//String with your numbers
var myNumbers:int[];

function DecodeString(){
  var stringArray:String[]=myString.Split("_"[0]);//Split myString wherever there's a _ and make a String array out of it.
  myNumbers=new int[stringArray.length];
  for(var num:int=0;num<stringArray.length;num++){
    myNumbers[num]=int.Parse(stringArray[num]);
  }
}

http://www.7solutions.in/2014/05/how-to-get-int-values-from-string-in.html