![]() |
|
A String
Occurrence Search and Replace Routine (PowerBuilder
7, 8 and 9)
long ll_StartPos = 1 string ls_old_str, ls_new_str, ls_txt_str ls_txt_str = sle_1.Text ls_old_str = "red" ls_new_str = "green" // Find the first occurrence of ls_old_str ... ll_StartPos = Pos(ls_txt_str, ls_old_str, ll_StartPos) // Only enter the loop if you find ls_old_str ... DO WHILE ll_StartPos > 0 // Replace old_str with ls_new_str ... ls_txt_str = Replace(ls_txt_str, ll_StartPos, Len(ls_old_str), ls_new_str) // Find the next occurrence of ls_old_str ll_StartPos = Pos(ls_txt_str, ls_old_str, ll_StartPos + Len(ls_old_str)) LOOP sle_2.Text = ls_txt_str
|
|||||||||||