Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to extract particular digit from a string
#4
Solved: 9 Years, 8 Months, 2 Weeks ago
Check this - 


Code:
Dim s : s = "3646456/3"

Set re = New RegExp 'Create Regular expression object
re.Pattern = "^\d+" 'Matches if a string starts with a digit

Set matches = re.Execute(s) 'Collection

If matches.Count <> 0 Then
msgbox matches(0).Value 'Output the first value if it exists
else
msgbox "The input string " & s & " doesn't start with a digit"
End If

We recently had a quiz on our blog and tackled a similar problem where we got brilliant answers in the comments section. Check this blog post Retrieve numbers from dynamic string using VB Script
Reply


Messages In This Thread
RE: How to extract perticular digit from a string - by Ankur - 10-05-2016, 10:49 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to extract part of a string between two particular characters. ACCBAJPA 7 7,064 08-22-2013, 02:39 PM
Last Post: ACCBAJPA
  XML Data read and extract output in an array SweetyChowdhury 9 8,981 05-10-2013, 03:05 PM
Last Post: SweetyChowdhury
  How to extract numeric values hamzaz 3 4,568 04-26-2012, 03:15 PM
Last Post: ssvali
  How to have a variable that has a string comma string .. shareq1310 5 5,706 11-09-2011, 03:33 PM
Last Post: parminderdhiman84
At unable extract data from dynamic webtable anarsingrao 3 5,147 12-17-2009, 03:44 PM
Last Post: amoghrane

Forum Jump:


Users browsing this thread: 1 Guest(s)