Strip out additional chars from Phone Numbers

Below is a good SQR tip for stripping out special characters from those nasty Phone Number formats stored in HRMS.

 


begin-procedure main
.
.
do parse_phone($phone_number, $phone_number)
.
.
end-procedure main

 

begin-procedure parse_phone($iphone, :$rphone)
let #phonelen = length($iphone)
move 0 to #loops

while 1

let #loops = #loops + 1

let $value = substr($iphone, #loops, 1)
let #checkvalue = ascii($value)

if #checkvalue >= 48 and #checkvalue <= 57
let $rphone = $rphone//$value
end-if

if #phonelen = #loops
break
end-if

end-while
end-procedure parse_phone

转载于:https://www.cnblogs.com/GoDevil/archive/2009/01/09/1372670.html

你可能感兴趣的:(Strip out additional chars from Phone Numbers)