tags:

views:

32

answers:

1

Hi, I have some picture named like this . (like "2.jpeg", "1234.gif" etc.) how can I get the integer from the string?

I mean, is there something like the C function:

sscanf(myString,"%d", myInteger);

thanks

Alessandro

+1  A: 

You will need to remove the non-numeric portion and then call TryParse.

Dim numericPortion As String
Dim result As Integer

numericPortion = myString.Substring(0, myString.IndexOf('.'))
If (Not Int32.TryParse(numericPortion, ByRef result)) Then
    ''// Handle Error
Else
    ''// Use Result
End If
ChaosPandion