Extract numbers from a string ?
Sorry I just noticed that I did not attach the code... :)
Public Function FirstNumber(ByVal InputString As String) As Integer
Dim intCounter As Integer
Dim intStringLength As Integer
Dim intReturnValue As Integer
intReturnValue = -1
intStringLength = Len(InputString)
For intCounter = 1 To intStringLength
If IsNumeric(Mid(InputString, intCounter, 1)) Then
intReturnValue = intCounter
Exit For
End If
Next intCounter
FirstNumber = intReturnValue
End Function
The function returns the spot of the first digit...
HTH
"Jim Thomlinson" wrote:
Here is a function to find the first instance of a number within a string.
You can modify it to your little hearts content if it is not quite what you
were looking for.
HTH
"Jello" wrote:
I have serached the String class but cant see any function that can identify
integers within a string ?
I want to replace all instances of "Mystringwith10integer" with
"Mystringwith11integer" etc.
Is there such a funtion ?
Many thanks, Jello
|