S
spmm#
Hi!
I want to get the nummerical part from a string and put that in an integer.
For example if I enter "ns00086"; I want to get 86 back. Is there an easy
way of doing this?
So far I've come up with this method, but I'm suspecting there is a more
efficient way of doing it...
private int GetNummericalPartFromString(string myString)
{
char[] charArray;
string s = "0";
charArray = myString.ToCharArray();
foreach(char c in charArray)
{
if(char.IsDigit(c))
{
s = s + c;
}
}
return int.Parse(s);
}
I want to get the nummerical part from a string and put that in an integer.
For example if I enter "ns00086"; I want to get 86 back. Is there an easy
way of doing this?
So far I've come up with this method, but I'm suspecting there is a more
efficient way of doing it...
private int GetNummericalPartFromString(string myString)
{
char[] charArray;
string s = "0";
charArray = myString.ToCharArray();
foreach(char c in charArray)
{
if(char.IsDigit(c))
{
s = s + c;
}
}
return int.Parse(s);
}