[Pharo-project] bindWith: implementation missing

Benoit St-Jean bstjean at yahoo.com
Tue Jul 10 11:05:55 EDT 2012


Something like this ?


bindWith: arg1
    ^ self bindWithArguments: (OrderedCollection with: arg1)


bindWith: arg1 with: arg2
    | coll |
    coll := OrderedCollection with: arg1 with: arg2.
    ^ self bindWithArguments: coll


bindWith: arg1 with: arg2 with: arg3
    | coll |
    coll := OrderedCollection
        with: arg1
        with: arg2
        with: arg3.
    ^ self bindWithArguments: coll



bindWith: arg1 with: arg2 with: arg3 with: arg4
    | coll |
    coll := OrderedCollection
        with: arg1
        with: arg2
        with: arg3
        with: arg4.
    ^ self bindWithArguments: coll


bindWithArguments: aCollection

    | newString end |
    newString := self copy.
    end := aCollection size.
    end to: 1
        by: -1
        do: [:i | newString := newString copyReplaceAll: '%' , i printString with: (aCollection at: i)].
    ^newString



-----------------
Benoit St-Jean
Yahoo! Messenger: bstjean
A standpoint is an intellectual horizon of radius zero.
(Albert Einstein)


>________________________________
> From: Sabine Knöfel <sabine.knoefel at gmail.com>
>To: pharo-project at lists.gforge.inria.fr 
>Sent: Tuesday, July 10, 2012 10:49:51 AM
>Subject: [Pharo-project] bindWith: implementation missing
> 
>Hi All,
>
>I miss String>>bindWith:
>>>bindWith: with:
>etc.
>
>in Pharo. Is there a reason for that missing?
>Has anyone an implementation for me?
>I dont want to reinvent the wheel ;-)
>
>Greetings
>Sabine
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20120710/cfc694b7/attachment-0001.html>


More information about the Pharo-dev mailing list