i want to get only numbers from string.
Lest say that this is my string :
324ghgj123
i want to get:
324123
For a linear search approach you can use this algorithm, it’s in C# but can easily be translated in vb.net, hope it helps.
string str = “123a123”;
for(int i=0;i<str.length()-1;i++)
{
if(int.TryParse(str[i], out nval))
continue;
else
str=str.Rremove(i,i+1);
}
Function that returns string without digits
Public Function _RemoveNonDigitCharacters(S As String) As String
Return New String(S.Where(Function(x As Char) System.Char.IsDigit(x)).ToArray)
End Function