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