Convert lowercase alphabet letters before passing them to the next implementation. Already uppercase letters and other characters pass through unchanged.
trait CapitalisePlugIn extends Doc {
  abstract override def insert(x: Char, pos: Int): Unit = {
    val y = if ('a' <= x && x <= 'z') ('A' + (x - 'a')).toChar else x
    super.insert(y, pos)
  }
}
The character conversion uses the paper's contiguous lowercase and uppercase Latin ranges. Thus
Deletion, reading, and size need no overrides.

Articles by others on the same topic (0)

There are currently no matching articles.