![JAR search and dependency download from the Maven repository](/logo.png)
General.codepoint.scala Maven / Gradle / Ivy
/* Title: Pure/General/codepoint.scala
Author: Makarius
Unicode codepoints vs. Unicode string encoding.
*/
package isabelle
object Codepoint
{
def string(c: Int): String = new String(Array(c), 0, 1)
def iterator(s: String): Iterator[Int] =
new Iterator[Int] {
var offset = 0
def hasNext: Boolean = offset < s.length
def next: Int =
{
val c = s.codePointAt(offset)
offset += Character.charCount(c)
c
}
}
def length(s: String): Int = iterator(s).length
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy