Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/s5bug/utf8string
UTF-8 and Codepoint Strings for Scala
https://github.com/s5bug/utf8string
Last synced: 17 days ago
JSON representation
UTF-8 and Codepoint Strings for Scala
- Host: GitHub
- URL: https://github.com/s5bug/utf8string
- Owner: s5bug
- Created: 2022-01-13T20:41:53.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-01-14T02:35:01.000Z (about 3 years ago)
- Last Synced: 2024-11-10T16:12:39.865Z (2 months ago)
- Language: Scala
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# utf8string
A project that provides `Utf8String` and `CodepointString` for ScalaJVM and
ScalaJS.## example usage
```scala
import tf.bug.utf8string._val u8s = Utf8String("Hello! ヤッホー! 🎶")
println(u8s) // => Hello! ヤッホー! 🎶
println(u8s.byteAt(15)) // => -100 (= 0x9b)
val cps = u8s.toCodepointString
println(cps) // => Hello! ヤッホー! 🎶
println(cps.codepointAt(9)) // => 12507 (= 0x30db)
println(cps.codepointAt(cps.length - 1)) // => 127926 (= 0x1f3b6)
``````scala
import fs2._
import tf.bug.utf8string.fs2.utf8textval bytes = List(0xF0.toByte, 0x9F.toByte, 0x8E.toByte, 0xB6.toByte)
val toText = Stream.emits(bytes).through(utf8text.decodeUtf8)
toText.compile.toList // => List(🎶)
```