Okay, here's what to do. To find more expanded syntax, check out a post
I posted yesterday about table fields.

Save the string1 in a tmpstring field
Use STRSTR to find the index of the , then use SUBSTR to cut off the
first value. Compare it to string 2 to see if it's in there.

In your below example, you would see:

String1 = "20070821-001, 20070821-002, 20070821-002-A, 20070821-003, "

The first iteration, tmpstring = "20070821-001, 20070821-002,
20070821-002-A, 20070821-003, "
Now, take the SUBSTR($tmpstring$,0,STRSTR($tmpstring, ",")) or something
like that to grab just the first token, 20070821-001. Compare that to
string2, if it doesn't match, then set tmpstring =
SUBSTR($tmpstring$,STRSTR($tmpstring$,",")) which would now give you a
new value of: tmpstring = "20070821-002, 20070821-002-A, 20070821-003, "

Then just iterate until either tmpstring = $NULL$ or until you find your
value. 

By breaking up each token based on the comma, you can do a literal
compare so you don't run into the problem of it matching both string2
and string3 whenever it finds string3.

You will probably need to use LTRIM and/or RTRIM also.

Thanks,


Gary Opela, Jr

Sr. Remedy Developer

Leader Communications, Inc.

405 736 3211


-----Original Message-----
From: Action Request System discussion list(ARSList)
[mailto:[EMAIL PROTECTED] On Behalf Of Phil Murnane
Sent: Wednesday, August 22, 2007 10:14 AM
To: [email protected]
Subject: Repost: Wildcard in STRSTR function?

I couldn't find this post on the web server, so I thought I'd r
Folks:

I couldn't find this post on the web server, so I thought I'd repost it.
Any thoughts on this?

Thanks,
--Phil

----- Forwarded Message ----
From: Phil Murnane <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Cc: Phil Murnane <[EMAIL PROTECTED]>
Sent: Tuesday, August 21, 2007 10:32:23 AM
Subject: Wildcard in STRSTR function?


Folks:

Has anyone ever used a wildcard as the secnd parameter in a STRSTR() 
function?  I'm trying to test whether string2 exists in string1, where 
string2 may be a substring of string3 also in string one.  This is
similar 
to finding a Group ID in a $GROUPIDS$ result.

Example:
ARS 6.3
string1 = ", 20070821-001, 20070821-002, 20070821-002-A, 20070821-003, "
string2 = "20070821-002"
string3 = "20070821-002-A"

I can't just use STRSTR(string1, string2) because even if string1 did
not 
contain string2 this function would erroneously find the value, since 
string2 is a substring of string3.

Here's my syntax:
zScratchInteger = STRSTRC($string1$,(" %, " + $string2$ ) + ", %")

But this always returns -1 -- it never finds string2 in string1.

Is this because of the wildcard percent signs?

TIA,
--Phil


       
________________________________________________________________________
____________Ready for the edge of your seat? 
Check out tonight's top picks on Yahoo! TV. 
http://tv.yahoo.com/

________________________________________________________________________
_______
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org ARSlist:"Where
the Answers Are"

_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org ARSlist:"Where the 
Answers Are"

Reply via email to