summaryrefslogtreecommitdiff
path: root/src/reflect/scala/reflect/internal/util/StringOps.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-11-13 08:29:42 -0800
committerPaul Phillips <paulp@improving.org>2012-11-20 14:10:52 -0800
commite5b050814deb2e7e1d6d05511d3a6cb6b013b549 (patch)
tree0ff097e17c202bf9060a28757b081239b04f424c /src/reflect/scala/reflect/internal/util/StringOps.scala
parent50712cf5639bd42f420c540f526393a110f3349c (diff)
downloadscala-e5b050814deb2e7e1d6d05511d3a6cb6b013b549.tar.gz
scala-e5b050814deb2e7e1d6d05511d3a6cb6b013b549.tar.bz2
scala-e5b050814deb2e7e1d6d05511d3a6cb6b013b549.zip
Members removed in scala.reflect.
Not a bad showing for a newcomer. Of course most of this code predates scala.reflect by a lot.
Diffstat (limited to 'src/reflect/scala/reflect/internal/util/StringOps.scala')
-rw-r--r--src/reflect/scala/reflect/internal/util/StringOps.scala29
1 files changed, 2 insertions, 27 deletions
diff --git a/src/reflect/scala/reflect/internal/util/StringOps.scala b/src/reflect/scala/reflect/internal/util/StringOps.scala
index 5645eb4889..93bbfdd273 100644
--- a/src/reflect/scala/reflect/internal/util/StringOps.scala
+++ b/src/reflect/scala/reflect/internal/util/StringOps.scala
@@ -6,7 +6,6 @@
** |/ **
\* */
-
package scala.reflect.internal.util
/** This object provides utility methods to extract elements
@@ -16,24 +15,8 @@ package scala.reflect.internal.util
* @version 1.0
*/
trait StringOps {
- def onull(s: String) = if (s == null) "" else s
- def oempty(xs: String*) = xs filterNot (x => x == null || x == "")
- def ojoin(xs: String*): String = oempty(xs: _*) mkString " "
- def ojoin(xs: Seq[String], sep: String): String = oempty(xs: _*) mkString sep
- def ojoinOr(xs: Seq[String], sep: String, orElse: String) = {
- val ys = oempty(xs: _*)
- if (ys.isEmpty) orElse else ys mkString sep
- }
- def trimTrailingSpace(s: String) = {
- if (s.length == 0 || !s.charAt(s.length - 1).isWhitespace) s
- else {
- var idx = s.length - 1
- while (idx >= 0 && s.charAt(idx).isWhitespace)
- idx -= 1
-
- s.substring(0, idx + 1)
- }
- }
+ def oempty(xs: String*) = xs filterNot (x => x == null || x == "")
+ def ojoin(xs: String*): String = oempty(xs: _*) mkString " "
def longestCommonPrefix(xs: List[String]): String = {
if (xs.isEmpty || xs.contains("")) ""
else xs.head.head match {
@@ -57,14 +40,6 @@ trait StringOps {
def words(str: String): List[String] = decompose(str, ' ')
- def stripPrefixOpt(str: String, prefix: String): Option[String] =
- if (str startsWith prefix) Some(str drop prefix.length)
- else None
-
- def stripSuffixOpt(str: String, suffix: String): Option[String] =
- if (str endsWith suffix) Some(str dropRight suffix.length)
- else None
-
def splitWhere(str: String, f: Char => Boolean, doDropIndex: Boolean = false): Option[(String, String)] =
splitAt(str, str indexWhere f, doDropIndex)