Camel Case化

AppleScript名:Camel Case化
— Created 2015-12-24 by Shane Stanley
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"

camelCase("this is a pen") of me
–>  "thisIsAPen."

on camelCase(aPhrase)
  set firstWord to current application’s NSString’s stringWithString:(word 1 of aPhrase)
set firstWord to firstWord’s |lowercaseString|()
set restOfPhrase to current application’s NSString’s stringWithString:(text from word 2 to -1 of aPhrase)
set restOfPhrase to restOfPhrase’s capitalizedString()’s stringByReplacingOccurrencesOfString:space withString:""
set newPhrase to firstWord’s stringByAppendingString:restOfPhrase
return (newPhrase’s stringByFoldingWithOptions:(current application’s NSDiacriticInsensitiveSearch) locale:(missing value)) as text
end camelCase

★Click Here to Open This Script 

Please follow and like us:


メールアドレスが公開されることはありません。 * が付いている欄は必須項目です