Kbase P24927: How to search a space delimited list for the occurrence of a
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  5/10/2003 |
|
Status: Unverified
GOAL:
How to search a space delimited list for the occurrence of a string?
FIX:
Use the LOOKUP function which returns an integer giving the position of an expression in a list. It Returns a 0 if the expression is not in the list. For example:
DEFINE VARIABLE cMyList AS CHARACTER INITIAL "JOHN JACK JILL" NO-UNDO .
DEFINE VARIABLE cMyString AS CHARACTER INITIAL "JILL" NO-UNDO.
IF LOOKUP( cMyString, cMyList, " ") > 0 THEN
MESSAGE cMyString "is in "cMyList
VIEW-AS ALERT-BOX INFO BUTTONS OK.
ELSE
MESSAGE cMyString "is NOTin "cMyList
VIEW-AS ALERT-BOX INFO BUTTONS OK.