Strip comments from a string: Difference between revisions
Content deleted Content added
Line 354: | Line 354: | ||
}</lang> |
}</lang> |
||
=={{header| |
=={{header|ANSI BASIC}}== |
||
<lang ansibasic>100 DECLARE EXTERNAL FUNCTION FNstripcomment$ |
|||
<lang bbcbasic> marker$ = "#;" |
|||
110 LET marker$="#;" |
|||
⚫ | |||
120 PRINT """";FNstripcomment$("apples, pears # and bananas", marker$);"""" |
|||
130 PRINT """";FNstripcomment$("apples, pears ; and bananas", marker$);"""" |
|||
⚫ | |||
150 END |
|||
160 ! |
|||
170 EXTERNAL FUNCTION FNstripcomment$(text$, delim$) |
|||
LOCAL I%, D% |
|||
180 FOR I=1 TO LEN(delim$) |
|||
190 LET D = POS(text$, delim$(I:I)) |
|||
200 IF D>0 THEN LET text$ = text$(1:D-1) |
|||
210 NEXT I |
|||
220 LET FNstripcomment$=RTRIM$(text$) |
|||
WHILE ASC(text$) = 32 text$ = MID$(text$,2) : ENDWHILE |
|||
230 END FUNCTION</lang> |
|||
WHILE LEFT$(text$) = " " text$ = RIGHT$(text$) : ENDWHILE |
|||
= text$</lang> |
|||
=={{header|Bracmat}}== |
=={{header|Bracmat}}== |