Re: writeln Function while reading a Text File is printing appending text "before text" and "after text" at the same position

2020-06-05 Thread Ali Çehreli via Digitalmars-d-learn
On 6/3/20 1:43 PM, BoQsc wrote: Chomp sounds kind of funny hahaha. Also consider strip, stripLeft, and stripRight. (Not because they may be funny but because they are useful as well. :) ) Ali

Re: writeln Function while reading a Text File is printing appending text "before text" and "after text" at the same position

2020-06-03 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Jun 03, 2020 at 08:43:43PM +, BoQsc via Digitalmars-d-learn wrote: > On Wednesday, 3 June 2020 at 20:05:52 UTC, ttk wrote: [...] > > That works, but consider using chomp() instead. > > > > https://dlang.org/phobos/std_string.html#.chomp > > Chomp sounds kind of funny hahaha. > Who

Re: writeln Function while reading a Text File is printing appending text "before text" and "after text" at the same position

2020-06-03 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 3 June 2020 at 20:05:52 UTC, ttk wrote: On Wednesday, 3 June 2020 at 19:53:03 UTC, BoQsc wrote: Removing the last element of the string got it resolved. Might not be the best way and adding additional check for carriage return before removing the element would be better, so this

Re: writeln Function while reading a Text File is printing appending text "before text" and "after text" at the same position

2020-06-03 Thread ttk via Digitalmars-d-learn
On Wednesday, 3 June 2020 at 19:53:03 UTC, BoQsc wrote: Removing the last element of the string got it resolved. Might not be the best way and adding additional check for carriage return before removing the element would be better, so this is only initial proof. Improved example with the

Re: writeln Function while reading a Text File is printing appending text "before text" and "after text" at the same position

2020-06-03 Thread BoQsc via Digitalmars-d-learn
Removing the last element of the string got it resolved. Might not be the best way and adding additional check for carriage return before removing the element would be better, so this is only initial proof. Improved example with the above comments resolved. testingGround.d import

Re: writeln Function while reading a Text File is printing appending text "before text" and "after text" at the same position

2020-06-03 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 3 June 2020 at 18:49:38 UTC, ttk wrote: On Wednesday, 3 June 2020 at 18:23:51 UTC, BoQsc wrote: Here you can see ". hahahahahahaha" and "nononono" and even lineNumber is being merged into the same position. Why is this happening and can this be simply resolved? Your string in

Re: writeln Function while reading a Text File is printing appending text "before text" and "after text" at the same position

2020-06-03 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/3/20 2:23 PM, BoQsc wrote: C:\Users\vaida\Desktop\Associative Array Sorting> rdmd testingGround.d 0.  The quick brown fox jumps over the lazy dog nonononoahahahaha Sphinx of black quartz, judge my vow. 2. # How vexingly quick daft zebras jump! 3. # The five boxing wizards jump quickly 4. #

Re: writeln Function while reading a Text File is printing appending text "before text" and "after text" at the same position

2020-06-03 Thread ttk via Digitalmars-d-learn
On Wednesday, 3 June 2020 at 18:23:51 UTC, BoQsc wrote: Here you can see ". hahahahahahaha" and "nononono" and even lineNumber is being merged into the same position. Why is this happening and can this be simply resolved? Your string in "line" has a carriage return character at the end,

writeln Function while reading a Text File is printing appending text "before text" and "after text" at the same position

2020-06-03 Thread BoQsc via Digitalmars-d-learn
C:\Users\vaida\Desktop\Associative Array Sorting> rdmd testingGround.d 0. The quick brown fox jumps over the lazy dog nonononoahahahaha Sphinx of black quartz, judge my vow. 2. # How vexingly quick daft zebras jump! 3. # The five boxing wizards jump quickly 4. # Maecenas consectetur risus a