summaryrefslogtreecommitdiff
path: root/src/library
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2009-06-02 21:32:36 +0000
committerMartin Odersky <odersky@gmail.com>2009-06-02 21:32:36 +0000
commitcf4c6c334a045b6da6ad9ea0249a6602e9558649 (patch)
tree8f75fb6513f42cfc183709b9609da2c183dc97dc /src/library
parent02ec6b9c108283f3657f4d1c3f33827da573dc03 (diff)
downloadscala-cf4c6c334a045b6da6ad9ea0249a6602e9558649.tar.gz
scala-cf4c6c334a045b6da6ad9ea0249a6602e9558649.tar.bz2
scala-cf4c6c334a045b6da6ad9ea0249a6602e9558649.zip
fixed some problems with positions.
Diffstat (limited to 'src/library')
-rw-r--r--src/library/scala/Enumeration.scala13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/library/scala/Enumeration.scala b/src/library/scala/Enumeration.scala
index f3a6b2f68c..7edd390c02 100644
--- a/src/library/scala/Enumeration.scala
+++ b/src/library/scala/Enumeration.scala
@@ -64,13 +64,12 @@ abstract class Enumeration(initial: Int, names: String*) {
/** The name of this enumeration.
*/
override def toString = {
- val cname = this.getClass().getName()
- if (cname endsWith "$")
- cname.substring(0, cname.length() - 1)
- else if (cname endsWith "$class")
- cname.substring(0, cname.length() - 6)
- else
- cname
+ var string = getClass.getName
+ val idx1 = string.lastIndexOf('.' : Int)
+ if (idx1 != -1) string = string.substring(idx1 + 1)
+ val idx2 = string.indexOf('$')
+ if (idx2 != -1) string = string.substring(0, idx2)
+ string
}
/** The mapping from the integer used to identifying values to the actual