12,398,181 members (61,851 online)
Rate this:
See more:
`Dim strmystring as stirng = “record0030040acd035a856ab”`
In this case I want to find 040 (but it could be 034 or 856)
```Dim I as interger = strmystring.indexof(“040”)
Next ouput the substring
Dim strsubstring as string = strmystring.substring(i)```
Now my stirng looks like “040acd035a856ab”
With this string how can I output the fallowing:
040a
040c
040d

So I want the alphabets after 040, appreciate any ideas.
Posted 23-May-11 7:20am
Updated 23-May-11 7:24am
v2

Rate this:

Solution 1

If you know it only needs the next 4 characters...change your substring line to this:
`Dim strsubstring as string = strmystring.substring(i,4)`

The second parm on the substring function means you want to pull the next 4 characters.

You'll need to pull the whole thing like you did before. I suppose then you could loop through the string and look for the first character that is alpha...you could use the IsNumeric[^] function. Or you could figure out a way to do it with regular expressions.

Here are google results[^] for regular expressions. Here are CP Articles[^] for regular expressions. These should help you get started.
v2
Rate this:

Solution 2

I have written it:
```Module Module1

Sub Main()
Dim Str = "record0030040acd035a856ab"
Dim I = Str.IndexOf("040")

For a = I + 3 To Str.Length - 1
Dim Chr = Str(a)

If Char.IsLetter(Chr) Then
Console.WriteLine("040" + Chr)
Else
Exit For
End If
Next
End Sub

End Module
```
stopete82 23-May-11 13:36pm

Thanks this is what I was looking for.

Top Experts
Last 24hrsThis month
 OriginalGriff 460 Richard MacCutchan 265 Richard Deeming 244 ppolymorphe 230 Karthik Bangalore 155
 OriginalGriff 6,548 ppolymorphe 2,625 Karthik Bangalore 2,572 Richard MacCutchan 2,017 F-ES Sitecore 1,977