pb replace 替換指定字符

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

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章