1234567891011121314151617181920212223 |
- $PBExportHeader$f_pb_of_globalreplace.srf
- global type f_pb_of_globalreplace from function_object
- end type
- forward prototypes
- global function string f_pb_of_globalreplace (string as_source, string as_old, string as_new)
- end prototypes
- global function string f_pb_of_globalreplace (string as_source, string as_old, string as_new);long ll_oldlen, ll_newlen, ll_pos
- as_source=trim(as_source)
- as_old=trim(as_old)
- ll_pos = Pos(as_source,as_old)
- IF ll_pos > 0 Then
- ll_oldlen = Len(as_old)
- ll_newlen = Len(as_new)
- DO WHILE ll_pos > 0
- as_source = Replace(as_source,ll_pos,ll_oldlen,as_new)
- ll_pos = Pos(as_source,as_old,ll_pos + ll_newlen)
- LOOP
- END IF
- RETURN as_source
- end function
|