more operations;
authorwenzelm
Sat, 29 Apr 2017 10:50:48 +0200
changeset 65630 c41bbf657310
parent 65629 e6c0afe672fa
child 65631 ee917f172912
more operations;
src/Pure/General/bytes.scala
--- a/src/Pure/General/bytes.scala	Sat Apr 29 10:37:32 2017 +0200
+++ b/src/Pure/General/bytes.scala	Sat Apr 29 10:50:48 2017 +0200
@@ -121,6 +121,9 @@
 
   def isEmpty: Boolean = length == 0
 
+  def proper: Option[Bytes] = if (isEmpty) None else Some(this)
+  def proper_text: Option[String] = if (isEmpty) None else Some(text)
+
   def +(other: Bytes): Bytes =
     if (other.isEmpty) this
     else if (isEmpty) other