PROC Strip(CHAR ARRAY text,chars,result) BYTE i,j,pos,found pos=text(0) FOR i=1 TO text(0) DO found=0 FOR j=1 TO chars(0) DO IF text(i)=chars(j) THEN found=1 EXIT FI OD IF found THEN pos=i-1 EXIT FI OD WHILE pos>0 AND text(pos)=' DO pos==-1 OD SCopyS(result,text,1,pos) RETURN PROC Test(CHAR ARRAY text,chars) CHAR ARRAY result(255) Strip(text,chars,result) PrintF("""%S"", ""%S"" -> ""%S""%E%E",text,chars,result) RETURN PROC Main() Test("apples, pears # and bananas","#;") Test("apples, pears ; and bananas","#;") Test("qwerty # asdfg ; zxcvb","#") Test("qwerty # asdfg ; zxcvb",";") Test(" ;this is a comment","#;") Test("#this is a comment","#;") Test(" ",";") Test("","#") RETURN