global type gf_replace from function_object
end type
forward prototypes
global function integer gf_replace (ref string as_source, string as_old, string as_new)
end prototypes
global function integer gf_replace (ref string as_source, string as_old, string as_new);Integer li_Pos, li_OldLen, li_NewLen, li_Cnt
li_OldLen = Len(as_Old)
li_NewLen = Len(as_new)
li_Pos = Pos(Upper(as_Source), Upper(as_Old), 1)
Do While li_Pos > 0
as_Source = Replace(as_Source, li_Pos, li_OldLen, as_New)
li_Pos = Pos(Upper(as_Source), Upper(as_Old), (li_Pos + li_NewLen))
li_Cnt ++
Loop
Return li_Cnt
end function