On 6/13/15 6:45 AM, kerdemdemir wrote:
I have two strings(stringB,stringC) which I need to repeat(bCount times,
cCountTimes) and then chain.
auto charAppender = appender!(dchar[]);
auto totalStr = stringB.repeat(bCount).chain(stringC.repeat(cCount));
This compiles and works ok,
But when I try
On 06/13/2015 04:23 AM, Quentin Ladeveze wrote:
The problem is that your appender is a char appender, and you try to put
a dstring into it. Replace :
charAppender.put(totalStr);
by :
foreach(elem; totalStr){
charAppender.put(elem);
}
elem will be a dchar, so it will work.
To
On Saturday, 13 June 2015 at 13:09:20 UTC, Dennis Ritchie wrote:
auto stringB = readln.chomp.map!(to!dchar).array;
auto stringC = readln.chomp.map!(to!dchar).array;
auto charAppender = appender!(dchar[][]);
auto totalStr = stringB.repeat(3).chain(stringC.repeat(5));
On Saturday, 13 June 2015 at 13:32:19 UTC, kerdemdemir wrote:
One more question I am asking those kind of questions to
understand and not ask same stuff over and over, :
auto totalStr = chain(stringB.replicate(bCount),
stringC.replicate(cCount));
writeln(typeof(totalStr.array()).stringof);
On Saturday, 13 June 2015 at 12:02:10 UTC, kerdemdemir wrote:
The problem is that your appender is a char appender, and you
try to put a dstring into it. Replace :
charAppender.put(totalStr);
by :
foreach(elem; totalStr){
charAppender.put(elem);
}
elem will be a dchar, so it will work.
On Saturday, 13 June 2015 at 13:01:29 UTC, kerdemdemir wrote:
Sorry to making the discussion longer and wasting your times.
But I am looking for a way without for loops. Also looping
every element one by one does not seems very efficient to me.
Any advices for that?
Maybe it fit?
auto
It is the same, but totalStr is not a dchar[]. It's a Result (a
type internal to the chain function ) which is a range. The
foreach loop iterates over Result, which returns dchar[].
So if you try to do something like that :
charAppender.put(totalStr.array), it won't work because
On Saturday, 13 June 2015 at 13:32:19 UTC, kerdemdemir wrote:
Thanks lot that is really good.
One more question I am asking those kind of questions to
understand and not ask same stuff over and over, :
Don't worry, there is learn in D.learn
auto totalStr =
The problem is that your appender is a char appender, and you
try to put a dstring into it. Replace :
charAppender.put(totalStr);
by :
foreach(elem; totalStr){
charAppender.put(elem);
}
elem will be a dchar, so it will work.
But I can see in the example of
I have two strings(stringB,stringC) which I need to repeat(bCount
times, cCountTimes) and then chain.
auto charAppender = appender!(dchar[]);
auto totalStr =
stringB.repeat(bCount).chain(stringC.repeat(cCount));
This compiles and works ok,
But when I try to append new string to charAppender
On Saturday, 13 June 2015 at 10:45:58 UTC, kerdemdemir wrote:
I have two strings(stringB,stringC) which I need to
repeat(bCount times, cCountTimes) and then chain.
auto charAppender = appender!(dchar[]);
auto totalStr =
stringB.repeat(bCount).chain(stringC.repeat(cCount));
This compiles and
11 matches
Mail list logo