Hi All,

 

               Here is a moldy oldie from 2005: http://bugs.squeak.org/view.php?id=1821

 

               The arguments against increasing the size of classes worked on me.  All except two methods which I still use frequently.

 

               They are explode: and mergeDelimited:    (I changed the name of merge: to mergeDelimited: to make it more clear).

 

               "explode the collection into a collection of collections broken by aDelimiter"

               "(#(#(1 2) #(3 4)) mergeDelimited: Character tab ) explode: Character tab = an OrderedCollection(#(1 2) #(3 4))

               'abcdef' explode: 'cd' = an OrderedCollection('ab' 'ef')"

 

               I use these all the time.

              

               Example:

 

Mail >> replaceTokensIn: aString

                              ^self tokens inject: aString into: [:str :assoc |

                                             ((str explode: assoc key) mergeDelimited: assoc value value)].

              

               We have templates that users can throw tokens in like {!First Name} {!email}  then we just resolve the tokens and their evaluator block into an array

 

tokens: anArray

                              "Set an array of associations that represent token - value pairs

                              being substituted in the email. The keys are strings to be looked for,

                              the values are blocks being evaluated to obtain the string result."

                              standardTokens := anArray          

 

and process the template.

 

               While these two methods (explode: and mergeDelimited:) never actually made it into a release I still find them very useful.

 

               Daniela, Your partition looks like my explode.

 

               Ron Teitelbaum

 

 

Eliot Miranda wrote:

 

 

On Mon, Feb 24, 2014 at 1:58 PM, Norbert Hartl <norbert@hartl.name> wrote:

 

Am 24.02.2014 um 22:19 schrieb Eliot Miranda <eliot.miranda@gmail.com>:






On Mon, Feb 24, 2014 at 12:29 PM, Alexandre Bergel<alexandre.bergel@me.com> wrote:

Would be great to have: ‘ConfigurationOfRoassal’ chopCamel  => #(‘Configuration’ ‘Of’ ‘Roassal’).

 

'ConfigurationOfRoassal'  piecesCutWhere: [:a :b| a isLowercase and: [b isUppercase]] an OrderedCollection('Configuration' 'Of' 'Roassal')

 

It's too trivial, surely.

 

No it is not. Because you have to know about it. Thanks for that one. 

 

"I learned something today[tm]“

 

But the real things to learn are the Method Finder and the browser.  Adding a lot of names that are known to those that know some scripting language du jour, but are incomprehensible to me, and no doubt many others, is not doing anything for anybody, except trying to be pointlessly cool.  Trying to encourage programmers to use the ability of the system to self-introspect and self-document is giving them general skills they can build upon.  So a project to improve the UI so that programmers are led to tools they can use for discovery seems worth-while to me, while adding yet more short-hand to hand-hold the ignorant isn't helping, IMHO.

A modified Finder that had named fields for the formation of the "example" would go along way.  I went a long time without knowing how to work with this.  its a case of you-don't-know-what-you-don't-know
cheers -ben

 

 

Norbert




Alexandre



On Feb 24, 2014, at 2:30 PM, Daniela Meneses <daniela11290@gmail.com> wrote:

> Hi to all,
>
> As you may know I'm working on in some improvements for the String class. Until now I implemented some missing tests. Right now I'm looking forward to add new methods that could be useful based on Ruby API (http://www.ruby-doc.org/core-2.1.0/String.html). These are a few of the methods that I'm planning to implement:
>
>       • chomp(separator=$/) -> new_str
>       • chop() -> new_str
>       • ljust(integer, padstr='') ->new_str
>       • next -> new_str
>       • partition(sep) -> [head, sep, tail]
>
> Could you help to find out if these methods are already available for the String class?
>
> If you have any idea of new methods for the string class, will be really welcome.
>
> --
> Cheers,
> Daniela Meneses

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.





 

-- 
best,

Eliot

 



 

--
best,

Eliot