+withoutPrefix:
authorClaus Gittinger <cg@exept.de>
Wed, 30 Apr 2003 12:23:07 +0200
changeset 7247 1071f4c1fb75
parent 7246 58aff69e32b5
child 7248 3310596ab49c
+withoutPrefix:
CharacterArray.st
--- a/CharacterArray.st	Wed Apr 30 11:12:20 2003 +0200
+++ b/CharacterArray.st	Wed Apr 30 12:23:07 2003 +0200
@@ -5783,6 +5783,21 @@
     "Modified: 30.6.1997 / 13:40:23 / cg"
 !
 
+withoutPrefix:aString
+    "if the receiver startsWith aPrefix, return a copy without it.
+     Otherwise return the receiver"
+
+    (self startsWith:aString) ifTrue:[
+        ^ self copyFrom:aString size + 1
+    ].
+    ^ self
+
+    "
+     'helloworld' withoutPrefix:'hello'
+     'helloworld' withoutPrefix:'foo'
+    "
+!
+
 withoutSeparators
     "return a copy of myself without leading and trailing whitespace.
      (but whiteSpace in-between is preserved)
@@ -6367,7 +6382,7 @@
 !CharacterArray class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.242 2003-04-10 15:04:45 penk Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.243 2003-04-30 10:23:07 cg Exp $'
 ! !
 
 CharacterArray initialize!