Remove function?
Chris Cain
clcain at uncg.edu
Thu Dec 5 08:38:10 PST 2013
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.
More information about the Digitalmars-d-learn
mailing list