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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

find the position of a character within a string

Status
Not open for further replies.

fumbles

Programmer
Dec 9, 1999
43
US
Hi -

Can anyone let me know a reliable way to find the numeric position of a character or string within another string. In crystal, I can use the instr(ing) function to return the location of one string within another.

I am not seeing anything like that in progess. Hopefully there is one and I'm not recognizing the name.

We have product descriptions that contain a separating character ",". The text in front of the separator will print on some documents and webpages, the balance will not. It will be easier to export if I make the separation within progress and not make my users manipulate the string themselves.

Thanks

Steve

 
See INDEX function:

Code:
Returns an integer that indicates the position of the target string within the source string.

SYNTAX

INDEX ( source , target [ , starting ] )
source

A character expression.

target

A character expression whose position you want to locate in source. If target does not exist within source, INDEX returns a 0.

starting

An integer that specifies at which left-most position in the string to start the search. For example, INDEX("abcdefabcdef","abc",6) returns 7.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top