{"id":17506225,"url":"https://github.com/orchetect/swiftascii","last_synced_at":"2025-04-23T12:25:55.548Z","repository":{"id":46415626,"uuid":"334323196","full_name":"orchetect/SwiftASCII","owner":"orchetect","description":"Type-safe ASCIIString and ASCIICharacter types for Swift. (ASCII string, character)","archived":false,"fork":false,"pushed_at":"2024-09-29T22:26:21.000Z","size":99,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-20T08:09:07.222Z","etag":null,"topics":["ascii","character","characters","ios","macos","string","strings","swift","swift5","swift5-3","tvos","watchos"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/orchetect.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"orchetect"}},"created_at":"2021-01-30T03:58:09.000Z","updated_at":"2024-09-29T22:26:24.000Z","dependencies_parsed_at":"2024-01-15T09:06:39.992Z","dependency_job_id":"e5714e51-b9ae-4148-a517-48c26144b0cb","html_url":"https://github.com/orchetect/SwiftASCII","commit_stats":{"total_commits":34,"total_committers":1,"mean_commits":34.0,"dds":0.0,"last_synced_commit":"ac8400915003e988d5f4d1c97e9339a95bc9e635"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orchetect%2FSwiftASCII","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orchetect%2FSwiftASCII/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orchetect%2FSwiftASCII/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orchetect%2FSwiftASCII/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/orchetect","download_url":"https://codeload.github.com/orchetect/SwiftASCII/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250432450,"owners_count":21429674,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ascii","character","characters","ios","macos","string","strings","swift","swift5","swift5-3","tvos","watchos"],"created_at":"2024-10-20T03:34:09.768Z","updated_at":"2025-04-23T12:25:55.530Z","avatar_url":"https://github.com/orchetect.png","language":"Swift","funding_links":["https://github.com/sponsors/orchetect"],"categories":[],"sub_categories":[],"readme":"# SwiftASCII\n\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Forchetect%2FSwiftASCII%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/orchetect/SwiftASCII) [![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Forchetect%2FSwiftASCII%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/orchetect/SwiftASCII) [![License: MIT](http://img.shields.io/badge/license-MIT-lightgrey.svg?style=flat)](https://github.com/orchetect/SwiftASCII/blob/main/LICENSE)\n\n`ASCIIString` and `ASCIICharacter` types for Swift offering validation and lossy conversion from `String`.\n\nComplete unit test coverage.\n\n## Getting Started\n\n1. SwiftASCII is available as a Swift Package that can be added as a dependency in your app or package.\n\n   - In an Xcode app project or framework add the package dependency to your target using this URL:\n\n     `https://github.com/orchetect/SwiftASCII`\n     \n   - In a Swift Package, add it to the Package.swift dependencies:\n   \n     ```swift\n     .package(url: \"https://github.com/orchetect/SwiftASCII\", from: \"1.1.5\")\n     ```\n   \n2. Import the library:\n\n   ```swift\n   import SwiftASCII\n   ```\n\n### ASCIIString\n\n```swift\n// failable init\nASCIIString(exactly: \"An ASCII String.\") // succeeds\nASCIIString(exactly: \"Ãñ ÂŚÇÏÎ Strïńg.\") // nil\n\n// lossy string conversion making ASCII-compatible substitutions\nASCIIString(\"An ASCII String.\") // \"An ASCII String.\" (unchanged)\nASCIIString(\"Ãñ ÂŚÇÏÎ Strïńg.\") // \"An ASCII String.\" (substituted)\n\n// lossy string conversion through String literal type inference\nlet str: ASCIIString = \"Ãñ ÂŚÇÏÎ Strïńg.\"\nprint(str) // \"An ASCII String.\" (substituted)\n```\n\n```swift\nlet asciiString = ASCIIString(\"ÂŚÇÏÎ\")\n\n// returns typed as String\nasciiString.stringValue // \"ASCII\"\n\n// returns Data representation of string\nasciiString.rawData // Data([0x41, 0x53, 0x43, 0x49, 0x49])\n```\n\n### ASCIICharacter\n\n```swift\n// failable init\nASCIICharacter(exactly: \"A\") // succeeds\nASCIICharacter(exactly: \"Ω\") // nil\n\n// lossy string conversion making ASCII-compatible substitutions\nASCIICharacter(\"A\") // \"A\" (unchanged)\nASCIICharacter(\"Ã\") // \"A\" (substituted)\n\n// lossy character conversion through Character literal type inference\nlet char: ASCIICharacter = \"Ä\"\nprint(char) // \"A\" (substituted)\n\n// failable ASCII integer literal init\nASCIICharacter(65) // \"A\"\nASCIICharacter(300) // nil\n```\n\n```swift\nlet asciiString = ASCIICharacter(\"Ä\")\n\n// returns typed as Character\nasciiString.characterValue // Character(\"A\")\n\n// returns ASCII integer literal\nasciiString.asciiValue // 65\n\n// returns Data representation of character\nasciiString.rawData // Data([0x41])\n```\n\n## Author\n\nCoded by a bunch of 🐹 hamsters in a trenchcoat that calls itself [@orchetect](https://github.com/orchetect).\n\n## License\n\nLicensed under the MIT license. See [LICENSE](https://github.com/orchetect/SwiftASCII/blob/master/LICENSE) for details.\n\n## Contributions\n\nContributions are welcome. Feel free to post an Issue to discuss.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forchetect%2Fswiftascii","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Forchetect%2Fswiftascii","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forchetect%2Fswiftascii/lists"}