Remove function?
Brad Anderson
eco at gnuk.net
Wed Dec 4 14:02:27 PST 2013
On Wednesday, 4 December 2013 at 21:59:45 UTC, seany wrote:
> Hello, I want to remove a car form a string.
>
> hence i used the remove function from std.algorithm, and i had
> this :
>
> string stripPar(string S)
> {
> while(S[0] == '(' && S[S.length-1] == ')')
> {
>
> S = S.remove(0);
> S = S.remove(S.length-1);
> }
>
> return S;
> }
>
string is defined as: alias string = immutable(char)[]; This
means the string contents cannot be changed because the
individual characters are immutable. If you'd like to modify the
string I'd use a char[] in place of string.
More information about the Digitalmars-d-learn
mailing list