I have a ByteString line. I want to strip blanks and tabs at end of it. Blanks and tabs allowed between words. MxMatcher looks a bit like using a gun to kill a fly. Any suggestion about a time effective way of solving the problem? (obvious way: asOrderedCollection and then backtrack killing spaces & tabs until find non space/tab char).
Best regards,
CdAB
You can use #withBlanksTrimmed (and #withoutLineEndings) for that.
Best, Marcel
-- View this message in context: http://forum.world.st/Need-an-elegant-way-to-solve-a-simple-problem-tp485150... Sent from the Squeak - Dev mailing list archive at Nabble.com.
If stripping leading blanks is okay, then you can use #withBlanksTrimmed. Otherwise you can use the following oneliner:
string copyFrom: 1 to: (string lastIndexOfAnyOf: CharacterSet nonSeparators startingAt: string size ifAbsent: string size)
Levente
On Tue, 22 Sep 2015, Casimiro - GMAIL wrote:
I have a ByteString line. I want to strip blanks and tabs at end of it. Blanks and tabs allowed between words. MxMatcher looks a bit like using a gun to kill a fly. Any suggestion about a time effective way of solving the problem? (obvious way: asOrderedCollection and then backtrack killing spaces & tabs until find non space/tab char).
Best regards,
CdAB
The information contained in this message is confidential and intended to the recipients specified in the headers. If you received this message by error, notify the sender immediately. The unauthorized use, disclosure, copy or alteration of this message are strictly forbidden and subjected to civil and criminal sanctions.
==
This email may be signed using PGP key ID: 0x4134A417
Thnx Levente & Marcel. Problem solved with #withBlanksTrimmed.
Em 22-09-2015 11:06, Levente Uzonyi escreveu:
If stripping leading blanks is okay, then you can use #withBlanksTrimmed. Otherwise you can use the following oneliner:
string copyFrom: 1 to: (string lastIndexOfAnyOf: CharacterSet nonSeparators startingAt: string size ifAbsent: string size)
Levente
squeak-dev@lists.squeakfoundation.org