Lotus Notes FAQ Visit Our Sponsor!

How do you find the positions of a string in a text list?

Field - List = your input list
Field - FindChar = the thing you're trying to find in the list
Field - Position = multi value field with final position of the characters you're looking for.

Button code used to find the position of all of your characters:

NumInList := @Elements(List);
TargetFindList := @Explode(@Repeat(FindChar + ", " ; NumInList -1) + FindChar);
SeqList := @Text(@TextToNumber(("0":"1":"2":"3":"4":"5":"6":"7":"8":"9") *+
  ("0":"1":"2":"3":"4":"5":"6":"7":"8":"9")));
Seq := @Subset(@Subset(SeqList; -99); NumInList);
AltFindList := List + Seq;
AltTargetFindList := TargetFindList + Seq;
FindPos := @Replace(AltFindList; AltTargetFindList;Seq);
Final := @Trim(@Replace(FindPos;AltFindList;""));
@SetField("Position";@Trim(@Replace(FindPos;AltFindList;"")))


Applies to Notes Versions: 3, 4, 4.5, 4.6, 5
Last Modified: August 16, 1998