[ 파워빌더.공통함수 - RPAD LPAD ]

 

☞   

 

**** LPAD함수 만들어 사용하기 *****

//paturn으로 채우기

==================================================================================================

global type lpad from function_object
end type

forward prototypes
global function string lpad (string as_data, char ac_paturn, integer ai_count)
end prototypes

global function string lpad (string as_data, char ac_paturn, integer ai_count);

    return as_data + fill(ac_paturn, ai_count - Len(as_data) )
end function
==================================================================================================

//밴공백으로 채우기

==================================================================================================

global type lpad from function_object
end type

forward prototypes
global function string lpad (string as_data, integer ai_count)
end prototypes

global function string lpad (string as_data, integer ai_count);

    return String( as_data, fill('@', ai_count) )
end function
==================================================================================================

 

**** RPAD함수 만들어 사용하기 *****

//paturn으로 채우기...

==================================================================================================

global type rpad from function_object
end type

forward prototypes
global function string rpad (string as_data, char ac_paturn, integer ai_count)
end prototypes

global function string rpad (string as_data, char ac_paturn, integer ai_count);

    return Reverse( Reverse(as_data) + fill(ac_paturn, ai_count - Len(as_data) ) )
end function
==================================================================================================

//빈공간으로 채우기

==================================================================================================

global type rpad from function_object
end type

forward prototypes
global function string rpad (string as_data, integer ai_count)
end prototypes

global function string rpad (string as_data, integer ai_count);

    return Reverse( String(Reverse(as_data), fill('@', ai_count ) ) )
end function
==================================================================================================

Posted by 농부지기
,