Remove function?

seany seany at uni-bonn.de
Thu Dec 5 08:59:48 PST 2013


On Thursday, 5 December 2013 at 16:38:11 UTC, Chris Cain wrote:
> On Thursday, 5 December 2013 at 15:46:41 UTC, seany wrote:
>> First thank you soooo much for clarification of the operation.
>
> You're welcome.
>
>> however, i tried your solution too. this failed with the same 
>> errors as mentioned in the first post of the thread..
>
> You sure that you don't have some other problem?
>
> file stripParTest.d:
> ---
> import std.algorithm;
>
> string stripPar(string S)
> {
>     while(S[0] == '(' && S[S.length-1] == ')')
>     {
>           S = S[1 .. $ - 1];
>     }
>
>     return S;
> }
>
> unittest {
>     string testData = "((a)";
>     string result = stripPar(testData);
>     assert(equal(result, "(a"));
> }
> ---
>
> run with: rdmd -unittest -main stripParTest.d
>
> Works fine for me.

I dont think i have other problems other than perhaps a bug in 
2.061 dmd?

By the way does your solution edit the physical memory in place, 
or just change the way it is pointed to? in case of the second, 
is there an appropriate garbage collector?


More information about the Digitalmars-d-learn mailing list