0

我正在尝试找到一种写俄语的解决方案,但使用拉丁字符(请参阅想法 translit.ru)

我的想法是写一个 AppleScript 之类的东西: -> 选定的文本 -> 翻译它

Hpw dp 我在 ActionScript 中使用字符串逐个字符替换?

4

1 回答 1

1

用西里尔字符转移拉丁文提出了第一个重要问题。是 Unicode 还是拉丁和西里尔字符编码之间的转换?

您要求提供一个逐个字符替换的示例,我可以举一个示例来说明它是如何工作的。当然还有许多其他示例,但在这里您可以根据自己的喜好更改源列表和目标列表。

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
于 2012-03-06T22:31:08.810 回答