Hi I have the following problem I want to transform a string into another while removing a set of characters 'Uquillas G\'{o}mez' -> 'uquillasgomez' And I wonder how to do that? copyWithoutAll: I was thinking to create a string of the same size and copy only the valid characters. Now I do not know how to set the size of the resulting string. I could use stream. Any ideas is welcome. Stef
I did String streamContents: [ :str | aString do: [ :aChar | aChar isLetter ifTrue: [ str nextPut: aChar asLowercase ] ] ] I'm curious about other solution because I was lucky that isLetter exist. Stef Le 10/8/16 à 19:48, stepharo a écrit :
Hi
I have the following problem I want to transform a string into another while removing a set of characters
'Uquillas G\'{o}mez'
->
'uquillasgomez'
And I wonder how to do that?
copyWithoutAll:
I was thinking to create a string of the same size and copy only the valid characters.
Now I do not know how to set the size of the resulting string.
I could use stream.
Any ideas is welcome.
Stef
Would this work? 'Uquillas G\''{o}mez' onlyLetters asLowercase Esteban A. Maringolo 2016-08-10 15:00 GMT-03:00 stepharo <stepharo@free.fr>:
I did
String streamContents: [ :str | aString do: [ :aChar | aChar isLetter ifTrue: [ str nextPut: aChar asLowercase ] ] ]
I'm curious about other solution because I was lucky that isLetter exist.
Stef
Le 10/8/16 à 19:48, stepharo a écrit :
Hi
I have the following problem I want to transform a string into another while removing a set of characters
'Uquillas G\'{o}mez'
->
'uquillasgomez'
And I wonder how to do that?
copyWithoutAll:
I was thinking to create a string of the same size and copy only the valid characters.
Now I do not know how to set the size of the resulting string.
I could use stream.
Any ideas is welcome.
Stef
Now I was really wondering how I could copy characters by characters without relying on a stream to get a string from the correct size at the end. In particular copyWithout: and friends only works either with one subcollection or one elements and I have mulitple elements \ { } '` Stef Le 10/8/16 à 22:30, stepharo a écrit :
quite nice indeed!
Le 10/8/16 à 20:04, Esteban A. Maringolo a écrit :
'Uquillas G\''{o}mez' onlyLetters asLowercase
Why not use standard collection API? 'Uquillas G\''{o}mez' reject: [ :c | #($\ ${ $} $' $`) includes: c ] thenCollect: #asLowercase -- View this message in context: http://forum.world.st/manipulating-strings-tp4910349p4910451.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
2016-08-11 7:30 GMT+02:00 stepharo <stepharo@free.fr>:
Now I was really wondering how I could copy characters by characters without relying on a stream to get a string from the correct size at the end.
In particular copyWithout: and friends only works either with one subcollection or one elements and I have mulitple elements \ { } '`
Stef
copyWithoutAll: does not work ? 'Uquillas G\''{o}mez' copyWithoutAll: '\{}''`' -> 'Uquillas Gomez'
Le 10/8/16 à 22:30, stepharo a écrit :
quite nice indeed!
Le 10/8/16 à 20:04, Esteban A. Maringolo a écrit :
'Uquillas G\''{o}mez' onlyLetters asLowercase
participants (5)
-
Denis Kudriashov -
Esteban A. Maringolo -
Nicolai Hess -
stepharo -
webwarrior