CHANGING TWO LETTERS 2/3
Posted in 1995
z [ ...Continued From Previous Message ] # # # Update the index pointer into the string # # # ######################################################################### LET i = i + 1 ######################################################################### # # # See if the old pattern is found starting at the Ith position # # # ######################################################################### IF source_string[i, (i+old_len-1)] = old_pattern THEN ######################################################################### # # # Replace the string # # # ######################################################################### IF i = 1 THEN ######################################################################### # # # Old pattern is at the front of the source string # # # ######################################################################### IF source_string = old_pattern THEN ######################################################################### # # # Replacing one word # # # ######################################################################### LET source_string = new_pattern CLIPPED ELSE ######################################################################### # # # More after this word, thus tack the remaining on to the end # # # ######################################################################### LET source_string = new_pattern CLIPPED, source_string[(i+old_len), str_len] CLIPPED END IF ELSE ######################################################################### # # # The pattern is buried in the middle or at the end of the string # # # ######################################################################### IF i+old_len-1 = str_len THEN ######################################################################### # # # At the END OF THE STRING, nothing to tack on to the end # # # ######################################################################### LET source_string = source_string[1, (i-1)], new_pattern ELSE ######################################################################### # # # Buried in the middle, so something to tack on to the end # # # ######################################################################### LET source_string = source_string[1, (i-1)], new_pattern CLIPPED, source_string[(i+old_len), str_len] CLIPPED END IF END IF ######################################################################### # # # Adjust string length and adjust i to bypass the new pattern # # # ######################################################################### LET str_len = LENGTH(source_string CLIPPED) LET i = i + new_len - 1 END IF END WHILE z [ Continued In Next Message... ] --- ~ SPEED 1.40 [NR] ~