Replace algorithm in Informix 4GL so I can find it later.
DEFINE
str_hitext CHAR(130),
str_text CHAR(130),
str_escape CHAR(1)
LET str_escape = ASCII 27
FUNCTION replace_algorithm()
DEFINE
int_temp2 INTEGER,
int_hipos INTEGER,
int_hipos_old INTEGER,
int_pos INTEGER
LET int_temp2 = LENGTH(str_hitext)
LET int_pos = 1
LET str_text = " "
LET int_hipos = 1
LET int_hipos_old = 1
WHILE int_hipos <= int_temp2 - 7
IF str_hitext[int_hipos, int_hipos] = str_escape THEN
IF str_hitext[int_hipos + 1, int_hipos + 7] = "[32703m" OR str_hitext[int_hipos + 1, int_hipos + 7] = "[32723m" THEN
IF int_hipos - 1 >= int_hipos_old THEN
LET str_text[int_pos, int_pos + int_hipos - 1 - int_hipos_old] = str_hitext[int_hipos_old, int_hipos - 1]
LET int_pos = int_pos + int_hipos - int_hipos_old
END IF
LET int_hipos = int_hipos + 8
LET int_hipos_old = int_hipos
ELSE
LET int_hipos = int_hipos + 1
END IF
ELSE
LET int_hipos = int_hipos + 1
END IF
END WHILE
IF int_temp2 >= int_hipos_old THEN
LET str_text[int_pos, int_pos + int_temp2 - int_hipos_old] = str_hitext[int_hipos_old, int_temp2]
END IF
END FUNCTION