On Mon, Apr 4, 2011 at 2:30 AM, Jonathan M Davis wrote:
> On 2011-04-03 17:19, Aleksandar Ružičić wrote:
>> I definitely must sit down and read about ranges, as it seems I don't
>> quite get what exactly they are (and what types of ranges exists and
>> the difference between them)..
>>
>> > auto p
On 2011-04-03 17:19, Aleksandar Ružičić wrote:
> I definitely must sit down and read about ranges, as it seems I don't
> quite get what exactly they are (and what types of ranges exists and
> the difference between them)..
>
> > auto parts = array(splitter(input, '|'));
>
> That's a nice solution
I haven't even looked into std.array... sorry..
So I won't need custom function after all. Thanks!
I definitely must sit down and read about ranges, as it seems I don't
quite get what exactly they are (and what types of ranges exists and
the difference between them)..
>
> auto parts = array(splitter(input, '|'));
>
That's a nice solution! I wasn't aware of array() though..
But I would like to
Aleksandar R.:
> I want to split a string into an array of strings. As much as it seems
> trivial I just can't make it work.
>
> This is code I use for splitting:
>
> -
> auto input = "foo|bar"; // sample input string
> auto parts = spl
On 2011-04-03 16:34, Aleksandar Ružičić wrote:
> I want to split a string into an array of strings. As much as it seems
> trivial I just can't make it work.
>
> This is code I use for splitting:
>
> -
> auto input = "foo|bar"; // sample
Ok, here is my function which works as expected:
---
string[] explode(in string source, char separator) {
typeof(return) result;
size_t prev = 0;
foreach (i, c; source) {
if (c == separator) {