Re: Insert a char in string

2014-07-12 Thread Ali Çehreli via Digitalmars-d-learn
On 07/10/2014 09:05 AM, Alexandre wrote: I have a string X and I need to insert a char in that string... auto X = "100"; And I need to inser a ',' in position 3 of this string..., I try to use the array.insertInPlace, but, not work... I try this: auto X = "100"; auto N

Re: Insert a char in string

2014-07-11 Thread JR via Digitalmars-d-learn
On Thursday, 10 July 2014 at 19:33:15 UTC, simendsjo wrote: On 07/10/2014 06:05 PM, Alexandre wrote: I have a string X and I need to insert a char in that string... auto X = "100"; And I need to inser a ',' in position 3 of this string..., I try to use the array.insertInPlace, bu

Re: Insert a char in string

2014-07-10 Thread simendsjo via Digitalmars-d-learn
On 07/10/2014 09:58 PM, Alexandre wrote: > basically format > I read a cobol struct file... > > From pos X to Y I have a money value... but, this value don't have any > format.. > > 0041415 > > The 15 is the cents... bascally I need to put the ( comma ), we use > comma to separate th

Re: Insert a char in string

2014-07-10 Thread Alexandre via Digitalmars-d-learn
basically format I read a cobol struct file... From pos X to Y I have a money value... but, this value don't have any format.. 0041415 The 15 is the cents... bascally I need to put the ( comma ), we use comma to separate the cents, here in Brazil... On Thursday, 10 July 2014 at

Re: Insert a char in string

2014-07-10 Thread simendsjo via Digitalmars-d-learn
On 07/10/2014 06:05 PM, Alexandre wrote: > I have a string X and I need to insert a char in that string... > > auto X = "100"; > > And I need to inser a ',' in position 3 of this string..., I try to use > the array.insertInPlace, but, not work... > > I try this: > auto X = "1

Re: Insert a char in string

2014-07-10 Thread Alexandre via Digitalmars-d-learn
Oh, I used that letters in upper case, just for a simple sample... On Thursday, 10 July 2014 at 16:32:53 UTC, Marc Schütz wrote: On Thursday, 10 July 2014 at 16:20:29 UTC, Alexandre wrote: Sorry.. I mean: auto X = "100"; auto N = X.insertInPlace(3,','); On Thursday, 10 July 2014 a

Re: Insert a char in string

2014-07-10 Thread Alexandre via Digitalmars-d-learn
I used that solution: string InsertComma(string val) { return val[0 .. $-2] ~ "," ~ val[$-2 .. $]; } On Thursday, 10 July 2014 at 16:23:44 UTC, John Colvin wrote: On Thursday, 10 July 2014 at 16:05:51 UTC, Alexandre wrote: I have a string X and I need to insert a char in that string...

Re: Insert a char in string

2014-07-10 Thread via Digitalmars-d-learn
On Thursday, 10 July 2014 at 16:20:29 UTC, Alexandre wrote: Sorry.. I mean: auto X = "100"; auto N = X.insertInPlace(3,','); On Thursday, 10 July 2014 at 16:05:51 UTC, Alexandre wrote: I have a string X and I need to insert a char in that string... auto X = "100"; And

Re: Insert a char in string

2014-07-10 Thread Alexandre via Digitalmars-d-learn
Sorry.. I mean: auto X = "100"; auto N = X.insertInPlace(3,','); On Thursday, 10 July 2014 at 16:05:51 UTC, Alexandre wrote: I have a string X and I need to insert a char in that string... auto X = "100"; And I need to inser a ',' in position 3 of this string..., I tr

Re: Insert a char in string

2014-07-10 Thread John Colvin via Digitalmars-d-learn
On Thursday, 10 July 2014 at 16:05:51 UTC, Alexandre wrote: I have a string X and I need to insert a char in that string... auto X = "100"; And I need to inser a ',' in position 3 of this string..., I try to use the array.insertInPlace, but, not work... I try this: auto X = "1000

Insert a char in string

2014-07-10 Thread Alexandre via Digitalmars-d-learn
I have a string X and I need to insert a char in that string... auto X = "100"; And I need to inser a ',' in position 3 of this string..., I try to use the array.insertInPlace, but, not work... I try this: auto X = "100"; auto N = X.insertInPlace(1,'0');