Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

search line of text for a particular keyword Newbie! 1

Status
Not open for further replies.

Delphiwhat

Programmer
Apr 1, 2003
74
0
0
EU
Hi all

Could someone put in the right direction

I want to create a function to search a line of text for a particular keyword then capture the next 5 characters into a variable. For example if the keyword was 'LS>>'

and the line of text was

BEG>78>>LS>>45782>JP>8797

I want to grab the 45782 in to a variable for later use. Can someone give me an idea on how i can do this? a wee code example would be great
thanks in advance

dw
 
string ls_text, ls_keyword, ls_required
long ll_pos

ls_text = 'BEG>78>>LS>>45782>JP>8797'
ls_keyword = 'LS>>'
ll_pos = pos(ls_text, ls_keyword)
ls_required = mid(ls_text, ll_pos + len(ls_keyword), 5)
MessageBox('',ls_required)

Arnold

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top