2012-03-06 3 views
0

내가AppleScript로 "음역하여"기능

내 생각은 AppleScript로 떨어지게을 작성하는 것입니다 러시아어를 쓸 수있는 해결책을 찾기 위해 노력하고 있지만, 라틴 문자 (아이디어 translit.ru 참조)하고있어 같은 : -> 선택한 텍스트 -> 번역하기

Hpw dp ActionScript의 문자열을 문자 단위로 대체합니까?

답변

1

키릴 문자가있는 라틴어 전송은 중요한 질문을 던집니다. 그것은 유니 코드입니까, 아니면 라틴 문자와 키릴 문자 인코딩 간의 전송입니까?

문자를 문자로 교체하는 예를 요청했습니다. 어떻게 작동하는지 예를 들려 줄 수 있습니다. 물론 많은 다른 예제가 있지만 여기서 당신은 원하는대로 소스리스트와 타겟리스트를 변경할 수 있습니다.

set theString to "Hello World!" 
set sourceList to "abcdefghijklmnopqrstuvwxyz" 
set targetList to "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 

set newString to {} 
repeat with theChar in theString 
    set o to offset of theChar in sourceList 
    if o is 0 then 
     set end of newString to contents of theChar 
    else 
     set end of newString to character o of targetList 
    end if 
end repeat 
return newString as string