Remove function?

seany seany at uni-bonn.de
Wed Dec 4 14:13:51 PST 2013


On Wednesday, 4 December 2013 at 22:02:28 UTC, Brad Anderson 
wrote:
> 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.

does all the algorithms defined in std.string and std.algorithm 
also apply on char[] ? is there any way to force a string to 
become mutable?


More information about the Digitalmars-d-learn mailing list