--- a/CharacterArray.st Thu Feb 01 12:30:05 2018 +0100
+++ b/CharacterArray.st Thu Feb 01 13:58:15 2018 +0100
@@ -1019,6 +1019,49 @@
! !
+!CharacterArray class methodsFor:'utilities'!
+
+withoutAmpersandEscapes:label
+ "remove single ampersands;
+ replace double ampersands by single ones.
+ This is used to unescape menu-labels
+ (which use the ampersand as shortKey marker)"
+
+ ^ String
+ streamContents:[:out |
+ |in ch next|
+
+ in := label readStream.
+ [in atEnd] whileFalse:[
+ ch := in next.
+ ch == $& ifTrue:[
+ (next := in peek) == $& ifTrue:[
+ in next.
+ out nextPut:ch
+ ] ifFalse:[
+ ch := next
+ ].
+ ] ifFalse:[
+ out nextPut:ch
+ ].
+ ]
+ ]
+
+ "
+ String withoutAmpersandEscapes:''
+ String withoutAmpersandEscapes:'a'
+ String withoutAmpersandEscapes:'abcd'
+ String withoutAmpersandEscapes:'&abcd'
+ String withoutAmpersandEscapes:'&abcd&'
+ String withoutAmpersandEscapes:'&a&b&c&d'
+ String withoutAmpersandEscapes:'&a&b&c&d&'
+ String withoutAmpersandEscapes:'&&a&&b&&c&&d&&'
+ String withoutAmpersandEscapes:'&&a&&b&&c&&d&'
+ String withoutAmpersandEscapes:'&a&&b&&c&&d&'
+ String withoutAmpersandEscapes:'a&&b&&c&&d'
+ "
+! !
+
!CharacterArray methodsFor:'Compatibility-ANSI'!
addLineDelimiters