Jan 16, 2012

Replace string function

Sample : f_replace(powerbuilder,r,s) will return powesbuildes


f_replace(string as_text,string as_before,string as_after)  returns string

integer li_Posisi
string ls_return

li_Posisi = pos(as_text,as_before)
do while li_Posisi > 0
    ls_return += mid(as_text,1,li_Posisi - 1) + as_after
    as_text = mid(as_text, li_Posisi + Len(as_before))
    li_Posisi = pos(as_text,as_before)
loop
ls_return += as_text

return ls_text

cheers..

No comments:

Post a Comment