Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,41 @@
|
|||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue