Re: Text - change case
Re: Text - change case
- Subject: Re: Text - change case
- From: Bastiaan Boertien <email@hidden>
- Date: Thu, 19 May 2005 16:25:00 +0200
maybe this?
set theText to "APPLE COMPuters, the best COMPuters for me"
set theText1 to theText)
set theText2 to theText)
set theText3 to theText)
set theText4 to theText)
return theText1 & return & theText2 & return & theText3 & return & theText4
on theText)
set AppleScript's text item delimiters to space
set theTextList to every text item of theText
set AppleScript's text item delimiters to ""
set theNumberofItems to count theTextList
if theNumberofItems is equal to 1 then
return item 1 of theTextList)
else
set thenewTextList to {}
repeat with x from 1 to count theTextList
set end of thenewTextList to item x of theTextList)
end repeat
set AppleScript's text item delimiters to space
set theNewText to thenewTextList as string
set AppleScript's text item delimiters to ""
return theNewText
end if
end capitalizeAllWords
on theText)
set AppleScript's text item delimiters to space
set theTextList to every text item of theText
set AppleScript's text item delimiters to ""
set theNumberofItems to count theTextList
if theNumberofItems is equal to 1 then
return item 1 of theTextList)
else
set thenewTextList to {}
set end of thenewTextList to item 1 of theTextList)
set AppleScript's text item delimiters to space
set end of thenewTextList to items 2 thru -1 of theTextList)
set AppleScript's text item delimiters to ""
set AppleScript's text item delimiters to space
set theNewText to thenewTextList as string
set AppleScript's text item delimiters to ""
return theNewText
end if
end capitalizeFirstWord
on theText)
return do shell script "echo " & theText & " | tr '[a-z]' '[A-Z]'"
end capitalizeEveryCharacterOfEveryWord
on theText)
return do shell script "echo " & theText & " | tr '[A-Z]' '[a-z]'"
end unCapitalizeEveryCharacterOfEveryWord
on theText)
set firstChar to first character of theText
set AfterFirstCharacter to characters 2 thru -1 of theText
set firstChar to do shell script "echo " & firstChar & " | tr '[a-z]' '[A-Z]'"
set AfterFirstCharacter to do shell script "echo " & AfterFirstCharacter & " | tr '[A-Z]' '[a-z]'"
return firstChar & AfterFirstCharacter as string
end capitalizeFirstCharacter
Op 19 mei 2005 om 15:00 heeft Ruby Madraswala het volgende geschreven:
<x-tad-bigger>Hi All.</x-tad-bigger>
<x-tad-bigger> </x-tad-bigger>
<x-tad-bigger>It’s always the simple/basic that stumps me. I checked the web and books found no examples. I did find examples of changing to upper case or lower case, but not what I want.</x-tad-bigger>
<x-tad-bigger> </x-tad-bigger>
<x-tad-bigger> </x-tad-bigger>
<x-tad-bigger>Write counter & “ “ & item x of wordlist & return to outfile</x-tad-bigger>
<x-tad-bigger> </x-tad-bigger>
<x-tad-bigger>Item x of wordlist is in upper case: ex. APPLE COMPUTER and I want to write this as Apple Computer. Item x of wordlist can be one word or up to 5 words.</x-tad-bigger>
<x-tad-bigger> </x-tad-bigger>
<x-tad-bigger>OS 10.3.9</x-tad-bigger>
<x-tad-bigger> </x-tad-bigger>
<x-tad-bigger>Ruby</x-tad-bigger>
<x-tad-bigger> </x-tad-bigger>
<x-tad-bigger> </x-tad-bigger>
<x-tad-bigger> </x-tad-bigger>
<x-tad-bigger> </x-tad-bigger>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden