Skip to content

Determine the Unicode class of a mathematical character

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE.txt
MIT
LICENSE-MIT.txt
Notifications You must be signed in to change notification settings

satzlich/swift-unicode-math

Repository files navigation

swift-unicode-math

Platform Compatibility Swift Version

Swift equivalent of typst/unicode-math-class.

Add Dependency

let package = Package(
    // ...
    dependencies: [
        .package(url: "https://github.com/satzlich/swift-unicode-math", branch: "main"),
    ],

    // ...
    // .target(
    dependencies: [
        .product(name: "UnicodeMathClass", package: "swift-unicode-math"),
    ],
)

Example

XCTAssertEqual(mathClass("0"), MathClass.Normal)
XCTAssertEqual(mathClass("a"), MathClass.Alphabetic)
XCTAssertEqual(mathClass("𝔸"), MathClass.Alphabetic)
XCTAssertEqual(mathClass("+"), MathClass.Vary)
XCTAssertEqual(mathClass("×"), MathClass.Binary)
XCTAssertEqual(mathClass("("), MathClass.Opening)
XCTAssertEqual(mathClass(","), MathClass.Punctuation)
XCTAssertEqual(mathClass("|"), MathClass.Fence)
XCTAssertEqual(mathClass("😃"), nil)

Reference

License

This package is dual-licensed under the MIT and Apache 2.0 licenses.

About

Determine the Unicode class of a mathematical character

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE.txt
MIT
LICENSE-MIT.txt

Stars

Watchers

Forks

Packages

No packages published