Pages

2 juin 2008

Upper case words first letter (3/8)

script upperCaseWordsFirstLetter -- Majuscules 1ère lettre des mots
property parent : myLowerCase
property string1 : "æœäåçéñöüàãõÿâêáëèíîïìóôòúûùabcdefghijklmnopqrstuvwxyz"
property string2 : "ÆŒÄÅÇÉÑÖÜÀÃÕŸÂÊÁËÈÍÎÏÌÓÔÒÚÛÙABCDEFGHIJKLMNOPQRSTUVWXYZ"
on myProcess(theText)
set theText to theText as text
set theText to continue myProcess(theText) -- script mylowerCase
set temp to ""
set AppleScript's text item delimiters to " "
--••• every word of "to-to pi,po" --> {"to", "to", "pi", "po"} 
-- every text item of "to-to pi,po" --> {"to-to", "pi,po"} 
set theWords to every text item of theText
set AppleScript's text item delimiters to ""
repeat with theWord in theWords
set firstChar to nFindReplace(first character of theWord, string1, string2)
if the length of theWord > 1 then
set temp to temp & firstChar & characters 2 thru -1 of theWord & " "
else -- mot d'une lettre
set temp to temp & firstChar & " "
end if
end repeat
return characters 1 thru -2 of temp as string -- effacement espace final
end myProcess
end script


>>Ouvrir le script dans l'éditeur

Aucun commentaire: