[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: [sqr-users] SQR Code needed to convert employee name from upper case to m...
Oops! Forgot to put my name in it for advertising purposes. Let's have a
cigarette and try again...
begin-procedure capitalise($name,$ethnic,:$capitalised)
! by Timothy Chilman, email: ephedrasa@hotmail.com
let $capitalised = ''
let #len = length($name)
let #current_char = 1
let #new_word = 1
let $old_char = ' '
while #current_char <= #len
let #found_space = instr($name,' ',#current_char)
let $current_char = substr($name,#current_char,1)
if
! de Basto, de los Angeles but not two word surnames
(
(
instr($name,' ',#current_char) > 0 and
$ethnic <> '8' and
not ($old_char = ' ' and
instr($name,' ',#current_char) > #current_char+3)
) or
! exempt Chinese surnames from the above rule - requires a specific Chinese
ethnic group code
(
$ethnic = '8' and
$old_char <> ' '
) or
! Conventional surnames
(
instr($name,' ',#current_char) = 0 and
$old_char <> ' '
)
) and
! McDonald, O'Leary
not
(
#current_char = 3 and
(
substr($name,1,2) = 'MC' or
substr($name,1,2) = 'O'''
)
) and
! Duncan-Smith
$old_char <> '-'
let $current_char = lower($current_char)
else
let $current_char = upper($current_char)
end-if
#ifdef debugx
show $current_char ' ' #current_char ' new word ' #new_word ' 1st spc '
#found_space
#endif
if $current_char = ' '
let #new_word = #current_char
end-if
let $capitalised = $capitalised || $current_char
let #current_char = #current_char + 1
let $old_char = $current_char
end-while
end-procedure
_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users