Actually, I read the original email assuming that "2" was the little 2
character which shows up in the editor as a value mark, which is why the
author said the answer should be 5.
-Dianne
Charlie Rubeor wrote:
I believe there is a type in the original email. The search string should
actually be "AC2", which would be the fifth occurrence of a three
character code. Something like this:
AC2 BC2 CD2 AC2 AC2 BC2 SS
If you really must do this in a single line, and the length of the
substrings will always be three, this should work:
LASTOCC = INT(INDEX(STRING,SRCH,COUNT(STRING,SRCH))/3) + 1
Personally, I would hate to see that line of code in a program.
Charlie Rubeor
Unix/Database Administrator
Wiremold/Legrand
60 Woodlawn Street
West Hartford, CT 06110
Tel: 860.233.6251 x3498
Fax: 860.523.3690
Email: [EMAIL PROTECTED]
Internet: www.wiremold.com
"George Gallen" <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]
09/28/2005 12:01 PM
Please respond to
[email protected]
To
<[email protected]>
cc
Subject
RE: [U2] To locate the last occurrence of a sub-string in a string
Should be:
LASTOCC=INDEX(STRING,SRCH,COUNT(STRING,SRCH))
And 13 should be returned, not 5
George
-----Original Message-----
From: George Gallen
Sent: Wednesday, September 28, 2005 11:55 AM
To: '[email protected]'
Subject: RE: [U2] To locate the last occurrence of a sub-string in a
string
What about XIND=INDEX(STRING,SRCH,1,COUNT(STRING,SRCH))
(Untested).
George
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Hari T. K. Varma
Sent: Wednesday, September 28, 2005 11:35 AM
To: [email protected]
Subject: [U2] To locate the last occurrence of a sub-string in a string
Hi
Is there any direct one step method to locate the position of last
occurrence of a Sub-string in an existing string.
For ex:- to locate the last occurrence of "AC" in the string
X="AC2BC2CD2AC2AC2BC2SS" for this case the position should be returned
5.
Your valuable inputs will be appreciated
Thanks,
Hari Varma
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/