std.array suggestion

David Medlock noone at nowhere.com
Thu Mar 9 08:02:01 PST 2006


Oskar Linde wrote:
<snip>
> Oskar

I would also add:

T[]  left( T[] array, int n )
T[]  right( T[] array, int n )
T[]  skip( T[] array, int n )

In my own personal parsing stuff I regularly use the above plus:

T[]  countUntil( char[] str, bool delegate(char) pred );
T[]  countWhile( char[] str, bool delegate(char) pred );

So skipping whitespace becomes:

text = skip( text.countWhile( delegate bool(char c){ c<=32; } ) );

-DavidM



More information about the Digitalmars-d mailing list