as_data 에 포함된 특정 문자(열)을 모두 바꿉니다.

as_before : 변경 전 문자(열)

as_after : 변경 후 문자(열)

 

Return Type : string

Function Name :  gf_replace

Argument Type : string   Argument Name : as_data

Argument Type : string   Argument Name : as_before

Argument Type : string   Argument Name : as_after



int li_p, li_s = 1, li_len_b, li_len_a

 

li_len_b = len(as_before) // 이전 문자 크기

li_len_a = len(as_after)   // 이후 문자 크기

do 

   li_p = pos(as_data, as_before, li_s)

 

   if li_p > 0 then

      as_data = replace(as_data, li_p, li_len_b, as_after)

      li_s = li_p + li_len_a

   else

      exit

   end if

 

loop while 1=1

 

return as_data



예)

gf_replace('ASDBSD', 'SD', 'ZZ')

 

-> ‘AZZBZZ’ 을 반환합니다.

 

 

Posted by A4M
,