76 lines
1.2 KiB
Plaintext
76 lines
1.2 KiB
Plaintext
maintenance:
|
|
|
|
title: String Parsing MLM ;;
|
|
mlmname: UTIL_STRING_PARSE;;
|
|
arden: version 2;;
|
|
version: 1.00;;
|
|
institution: Eclipsys Corporation;;
|
|
author: ;;
|
|
specialist: ;;
|
|
date: 2006-04-07;;
|
|
validation: testing;;
|
|
|
|
library:
|
|
purpose:
|
|
Takes a string and extract out all substrings delimited by a given character.
|
|
Returns a list of sub-strings
|
|
;;
|
|
explanation:
|
|
;;
|
|
keywords:
|
|
;;
|
|
knowledge:
|
|
type: data-driven;;
|
|
data:
|
|
( str,
|
|
delimiter
|
|
) := ARGUMENT;
|
|
;;
|
|
evoke: /* Call MLM */
|
|
;;
|
|
logic:
|
|
|
|
StringList := ();
|
|
|
|
if str IS NOT NULL then
|
|
|
|
if delimiter is NULL then
|
|
delimiter := ","; // comma
|
|
endif;
|
|
|
|
characterList := extract characters str;
|
|
cnt := count (characterList);
|
|
|
|
indexList := 1 SEQTO cnt;
|
|
|
|
newList := ();
|
|
newString := null;
|
|
|
|
for X in indexList do
|
|
ch := characterList[X];
|
|
|
|
if ch = delimiter then
|
|
newString := string( newList );
|
|
StringList := StringList, newString;
|
|
newString := null;
|
|
newList := ();
|
|
else
|
|
newList := newList, ch;
|
|
endif;
|
|
enddo;
|
|
|
|
newString := string( newList );
|
|
StringList := StringList, newString;
|
|
|
|
endif;
|
|
|
|
conclude true;
|
|
;;
|
|
action:
|
|
|
|
return StringList ;
|
|
|
|
;;
|
|
Urgency: 50;;
|
|
end:
|