BCX Console Demonstration Program s39.bas
|
DIM i
DIM z$
z$ = " We'll replace all spaces with underscores "
WHILE INSTR(z$, " ")
i = INSTR(z$, " ")
IF i THEN
z$ = MID$(z$, 1, i - 1) & "_" & MID(z$, i + 1, LEN(z$))
END IF
PRINT z$
WEND
Result:
_ We'll replace all spaces with underscores
__ We'll replace all spaces with underscores
___We'll replace all spaces with underscores
___We'll_ replace all spaces with underscores
___We'll__ replace all spaces with underscores
___We'll___replace all spaces with underscores
___We'll___replace_ all spaces with underscores
___We'll___replace__ all spaces with underscores
___We'll___replace___all spaces with underscores
___We'll___replace___all_ spaces with underscores
___We'll___replace___all__ spaces with underscores
___We'll___replace___all___spaces with underscores
___We'll___replace___all___spaces_ with underscores
___We'll___replace___all___spaces__ with underscores
___We'll___replace___all___spaces___with underscores
___We'll___replace___all___spaces___with_ underscores
___We'll___replace___all___spaces___with__ underscores
___We'll___replace___all___spaces___with___underscores
___We'll___replace___all___spaces___with___underscores_
___We'll___replace___all___spaces___with___underscores__