Anothjer silly String question

karl karl.ramberg at chello.se
Tue Nov 15 18:53:53 UTC 2005


Bob.Cowdery at CGI-Europe.com wrote:

> I'm trying to figure out not just a way to do various string 
> manipulations but the right way as it's pretty basic stuff. Apart from 
> taking substrings and concatenating them is there a way to remove 
> characters from a string.
>
>  
>
> e.g. I have a string '3.669' and I want to remove the '.'
>
> In a workspace I can type '3.669' replaceAll: $. with: $ and then 
> print it and it works provided there is nothing after the second $. 
> However in a method if I put a dot after the last $ as a terminator it 
> takes it as a character and wants another dot for the terminator. I 
> tried it in a block and still can't get away without putting a dot 
> after the $. Is there some way to express this or am I barking up the 
> wrong tree again.
>
>  
>
If you try to inspect the result instead of printing it you will get a 
inspector in the result string.
The you click on the second entry you will get that characters value eg. 30.
Then you can replace the $ with a Character value:30 and you get:
'3.669' replaceAll: $. with: (Character value:30)

Karl




More information about the Squeak-dev mailing list