Function to find string
Moderators: chulett, rschirm, roy
Function to find string
Hi,
What function can I use to find a string in a field..The specific string may be anywhere in the whole field.. I am trying to find the string..If it is found, I have to do something If not something else.
Thanks
What function can I use to find a string in a field..The specific string may be anywhere in the whole field.. I am trying to find the string..If it is found, I have to do something If not something else.
Thanks
-
- Premium Member
- Posts: 224
- Joined: Tue Sep 24, 2002 7:32 am
- Location: Denver, CO USA
-
- Charter Member
- Posts: 130
- Joined: Mon Sep 06, 2004 3:05 am
- Location: Dubai,UAE
Function to find string
You can also try the COMPARE function ![Smile :)](./images/smilies/icon_smile.gif)
![Smile :)](./images/smilies/icon_smile.gif)
Warm Regards,
Amruta Bandekar
<b>If A equals success, then the formula is: A = X + Y + Z, X is work. Y is play. Z is keep your mouth shut. </b>
--Albert Einstein
Amruta Bandekar
<b>If A equals success, then the formula is: A = X + Y + Z, X is work. Y is play. Z is keep your mouth shut. </b>
--Albert Einstein
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
INDEX(string, search_string, occurrence)
- INDEX("I had to edit it", "it", 1) finds the first occurrence of "it" in the original string (at character position 12) and returns 12.
INDEX("I had to edit it", "it", 2) finds the second occurrence of "it" in the original string (at character position 15) and returns 15.
INDEX("I had to edit it", "it", 3) searches for the third occurrence of "it" in the original string, fails to find it, and returns 0.
Code: Select all
If Index("ABC", A, 2) Then "at least two A characters" Else "less than two A characters"
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
Sai,
I have to look for some set (around 40) of words/strings like "REHAB" and so on in a field of 50 bytes.. If I find these strings "REHAB" some where in the field, Then I have to map some thing in field1, field2, filed3, field4..If I dont find any of those set of words, i need to map some other thing in field1, field2, filed3, field4..
i am thinking to use the Index function in Stage Var and map accordingly..anymore suggestions..welcome !! :)
Thanks
I have to look for some set (around 40) of words/strings like "REHAB" and so on in a field of 50 bytes.. If I find these strings "REHAB" some where in the field, Then I have to map some thing in field1, field2, filed3, field4..If I dont find any of those set of words, i need to map some other thing in field1, field2, filed3, field4..
i am thinking to use the Index function in Stage Var and map accordingly..anymore suggestions..welcome !! :)
Thanks
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: