#FEATURE by cg
authorClaus Gittinger <cg@exept.de>
Wed, 04 May 2016 08:16:24 +0200
changeset 19698 87d14d6f90ca
parent 19697 d937d19b4871
child 19699 01a9805ec9ab
#FEATURE by cg class: CharacterArray added: #unquote: comment/format in: #quote changed: #unquote
CharacterArray.st
--- a/CharacterArray.st	Wed May 04 07:49:57 2016 +0200
+++ b/CharacterArray.st	Wed May 04 08:16:24 2016 +0200
@@ -363,6 +363,7 @@
     "
 ! !
 
+
 !CharacterArray class methodsFor:'pattern matching'!
 
 matchEscapeCharacter
@@ -768,6 +769,7 @@
     ^ Unicode32String
 ! !
 
+
 !CharacterArray methodsFor:'Compatibility-ANSI'!
 
 addLineDelimiters
@@ -1722,22 +1724,32 @@
 
 unquote
     "removes double quotes from the receiver.
-     This is the JavaSccript standard unquote function."
-
-    |mySize|
-
-    (mySize := self size) >= 2 ifTrue:[
-	((self first == $") and:[self last == $"]) ifTrue:[
-	    ^ self copyFrom:2 to:mySize-1
-	].
-    ].
-    ^ self
+     This is the JavaScript standard unquote function."
+
+    ^ self unquote:$"
 
     "
      'hello' quote unquote
 
      JavaScriptParser evaluate:'''hello''.quote.unquote'
     "
+!
+
+unquote:quoteCharacter
+    "removes quoteCharacter from either end of the receiver."
+
+    |mySize|
+
+    (mySize := self size) >= 2 ifTrue:[
+        ((self first == quoteCharacter) and:[self last == quoteCharacter]) ifTrue:[
+            ^ self copyFrom:2 to:mySize-1
+        ].
+    ].
+    ^ self
+
+    "
+     '*hello*' unquote:$*
+    "
 ! !
 
 
@@ -5840,6 +5852,7 @@
     "Modified: 17.4.1997 / 12:50:23 / cg"
 ! !
 
+
 !CharacterArray methodsFor:'special string converting'!
 
 asUnixFilenameString
@@ -6896,6 +6909,7 @@
     "
 ! !
 
+
 !CharacterArray methodsFor:'substring searching'!
 
 findRangeOfString:subString