这不是你要找的 Repo! 👽

新的开发正在 gitlab.com/pdylong/romanize 进行 👌。

Romanize

将韩文字符串罗马化

这是一个用 Swift 4.0 版本编写的 Swift 库。

特性

安装

使用 Swift Package Manager 安装它。

// swift-tools-version:4.0

import PackageDescription

let package = Package(
    name: "YourApp",
    products: [
        .executable(name: "YourApp", targets: ["YourApp"]),
    ],
    dependencies: [
        .Package(url: "https://github.com/creekpld/romanize.git", from: "1.0.0")
    ],
    targets: [
        .target(
            name: "YourApp",
            dependencies: ["Romanize"],
            path: "Sources"),
    ]
)

用法

import Romanize

romanize("안녕 하세요") // --> annyeong haseyo
romanize("안녕 하세요", true) // --> an-nyeong ha-se-yo

使用流畅 API

Romanize()
    // set a custom syllable divider
    .set(divider: "_")
    // customize all jamos and romanization
    .set(headJamo: ., romanization: "M")
    .romanize("미안하지만 저는 이 근처 사람이 아니예요", true)

// --> Mi_an_ha_ji_Man jeo_neun i geun_cheo sa_ram_i a_ni_ye_yo

其他特性

Romanize()
    // generate 10 random hangul syllables 
    .genHan(10)

// something like this --> 믞쑠졮폦둨햅쵫멫쾜숛

其他实现

许可证

Romanize 在 MIT 许可证 的条款下以开源形式提供。