Capture part of character from Text

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all

I having a problem. I have a column contain text data. Each record will contain a character @. But the position of @ is unknown. So I can use Left,Right or Mid to subtract that record. Anyone can help me?
Thank you

Danny
 
Danny said:
Hi all,

I having a problem. I have a column contain text data. Each record will
contain a character @. But the position of @ is unknown. So I can use
Left,Right or Mid to subtract that record. Anyone can help me??
Thank you!

Use the InStr function.
InStr will returnm the position of a string or character within another
string

In the format InStr([start, ]string1, string2[, compare])

intCharacterPosition=Instr(1, "@", <string containing character>, 1)
You can then use left, right and mid to extract text knowing the location of
'@'

If you need to extract the data between two @ then try

intStart =Instr(1, "@", <string containing character>, 1)
intEnd=Instr(intStart, "@", <string containing character>, 1)

Then try Mid(<string>,intStart, (IntEnd-intStart)).

Andy
 
Back
Top