Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Find number in a string
#7
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi,
Let me explain the below in detailed.
Code:
txtstrng = "this is codeigo 86 testing numeric"

reqnum = Split(Split(txtstrng,"codeigo")(1),"testing")(0)
Let us look into the inner split first and then the outer split.
When you use split method using "codeigo", then it will breake into 2 strings.
Split(txtstrng,"codeigo")(1):
  String(0) = "this is codeigo"
  String(1)= "86 testing numeric"
So, Split(txtstrng,"codeigo")(1) = "86 testing numeric"
Now here again we are spliting the string with "testing"

  Split(Split(txtstrng,"codeigo")(1),"testing")(0):
  Split("86 testing numeric","testing")
When you use split method using "testing", then it will breake into 2 strings.
string(0)= "86 "
string(1)="testing numeric"

As we need the numeric value. We have to capture the first string i.e. string(0).


Please let me know if you still have any questions.
Thanks,
SUpputuri
Reply


Messages In This Thread
Find number in a string - by pjeigenn - 07-17-2010, 12:19 AM
RE: Find number in a string - by MVChowdary - 07-19-2010, 10:40 AM
RE: Find number in a string - by Arun Prakash - 07-19-2010, 12:32 PM
RE: Find number in a string - by pjeigenn - 07-21-2010, 12:07 AM
RE: Find number in a string - by basanth27 - 07-22-2010, 08:39 AM
RE: Find number in a string - by pjeigenn - 07-26-2010, 09:16 PM
RE: Find number in a string - by supputuri - 07-26-2010, 10:04 PM
RE: Find number in a string - by ngocvo3103 - 12-02-2010, 12:40 PM
RE: Find number in a string - by cdesserich - 12-02-2010, 01:32 PM
RE: Find number in a string - by bfakruddin - 12-03-2010, 04:26 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  VB Script:number of times a character appears in a string with position Jyobtech 1 12,061 08-07-2013, 01:03 PM
Last Post: anil2u
  Find capital letter in a string Arul 2 8,788 12-27-2011, 11:11 PM
Last Post: Arul
  How to have a variable that has a string comma string .. shareq1310 5 5,066 11-09-2011, 03:33 PM
Last Post: parminderdhiman84
  How to count a repeated number in number in particular range gollsrin 1 3,572 04-28-2011, 11:41 AM
Last Post: Saket
  Removing commas from a string and changing it to number indranilgoswamimcb 3 8,643 12-31-2010, 10:40 AM
Last Post: rajeshwar

Forum Jump:


Users browsing this thread: 2 Guest(s)