I'm trying to get from:
'hello how are you today'
to
'helloHowAreYouToday'
And I thought asCapitalizedPhrase asLegalSelector
would do the trick, but it doesn't.
What's the proper way to do this?
EDIT:
I think I should clarify my question; I already have a way to transform a string into a camelCase selector:
|aString aCamelCaseString|
aString := aString findTokens: $ .
aCamelCaseString := aString first.
aString allButFirst do: [:each | aCamelCaseString := aCamelCaseString , each capitalized].
I was just wondering whether Pharo has a standard system method to achieve the same :)
How about this?
| tokens |
tokens := 'this is a selector' findTokens: Character space.
tokens allButFirst
inject: tokens first
into: [:selector :token | selector, token capitalized]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With