On Fri, 30 Jul 2010 19:41:03 -0400, Justin Spahr-Summers
wrote:
On Fri, 30 Jul 2010 16:30:17 -0700, Jonathan M Davis
wrote:
On Friday, July 30, 2010 14:13:15 dcoder wrote:
> If I'm writing a program that pretty prints tree data, or output of
sql,
> like Oracle's sqlplus, or postgres equi
On Sat, 31 Jul 2010 05:37:41 -0400, Jason Spencer
wrote:
== Quote from Steven Schveighoffer ([email protected])'s article
I was wrong, I looked through the runtime and did not find such a
function.
std.string has a repeat() function. Try:
import std.string;
void main()
{
string div
== Quote from Steven Schveighoffer ([email protected])'s article
> I was wrong, I looked through the runtime and did not find such a
function.
std.string has a repeat() function. Try:
import std.string;
void main()
{
string divider = repeat("-", 5);
writeln(divider);
}
Jason
On Fri, 30 Jul 2010 16:30:17 -0700, Jonathan M Davis
wrote:
> On Friday, July 30, 2010 14:13:15 dcoder wrote:
> > If I'm writing a program that pretty prints tree data, or output of sql,
> > like Oracle's sqlplus, or postgres equivalent, I find having such a
> > utility function/constructor a pre
On Friday, July 30, 2010 14:13:15 dcoder wrote:
> If I'm writing a program that pretty prints tree data, or output of sql,
> like Oracle's sqlplus, or postgres equivalent, I find having such a
> utility function/constructor a pretty handy feature.
>
> I don't know where such a tool should finally
>
>
> I don't know where such a tool should finally be placed in D, but I having
> it
> available as a library or as part of the language would be great. It seems
> like a
> lot of other languages have it like python, perl, C++, and Java. So it
> can't be
> that useless.
>
There is fill() in st
== Quote from Jonathan M Davis ([email protected])'s article
> A makeArray() function wouldn't hurt any, but I don't think that it would
> really
> buy us much. Of course, truth be told, I've always thought that the ability to
> construct a string or vector in C++ all of a single value was pre
On Fri, 30 Jul 2010 16:31:49 -0400, Jonathan M Davis
wrote:
On Friday, July 30, 2010 13:10:46 Steven Schveighoffer wrote:
It's not. The only runtime functions available to the compiler look
like
this:
_d_newarrayT(TypeInfo ti, size_t length);
I guess that's one thing that comes of not
On Friday, July 30, 2010 13:10:46 Steven Schveighoffer wrote:
> On Fri, 30 Jul 2010 15:56:36 -0400, Jonathan M Davis
>
> wrote:
> > On Friday, July 30, 2010 10:14:45 Steven Schveighoffer wrote:
> >> I think a function to do it is fine, like makeArray('-', 5);
> >
> > Well, creating a function fo
Dnia 30-07-2010 o 22:15:50 Tomek Sowiński napisał(a):
writeln('-'.repeat.take(5));
Oh, and if repeat had slicing (as it should)... '-'.repeat[0..5]
Still, it's far cry from Python's '-' * 5
Tomek
Dnia 30-07-2010 o 17:24:41 dcoder napisał(a):
Is there anyway in D to convenient fill a string variable with a char
say X times?
If you need to only print, you can:
import std.stdio;
import std.range;
void main() {
foreach (c; take(repeat('-'), 5))
write(c);
}
I know, I know,
On Fri, 30 Jul 2010 15:56:36 -0400, Jonathan M Davis
wrote:
On Friday, July 30, 2010 10:14:45 Steven Schveighoffer wrote:
I think a function to do it is fine, like makeArray('-', 5);
Well, creating a function for producing an array literal and returning
it using
templates and string mixi
Jonathan M Davis:
> a makeArray() function would have exactly the same tools that you have to
> create
> an array of all the same value. So, it's not going to be any more efficient
> that
> what you can do.
Doesn't the D2 GC give you a lower level function to GC-allocate uninitialized
memory?
On Friday, July 30, 2010 10:14:45 Steven Schveighoffer wrote:
> I think a function to do it is fine, like makeArray('-', 5);
Well, creating a function for producing an array literal and returning it using
templates and string mixins wouldn't be all that hard, but if you want to
create
a dynamic
On Fri, 30 Jul 2010 12:46:20 -0400, bearophile
wrote:
Steven Schveighoffer:
> char[] divider = new char[5];
> divider[] = '-';
That assigns 0xff to all divider chars, and then assigns '-'. I think
there's a way to do it without the initial assignment.
I was wrong, I looked throug
Steven Schveighoffer:
> > char[] divider = new char[5];
> > divider[] = '-';
>
> That assigns 0xff to all divider chars, and then assigns '-'. I think
> there's a way to do it without the initial assignment.
In past there was some way to do that:
typedef char mchar = '-';
mchar[] divid
On Fri, 30 Jul 2010 11:46:32 -0400, Justin Spahr-Summers
wrote:
On Fri, 30 Jul 2010 11:35:15 -0400, Steven Schveighoffer
wrote:
If you want to allocate a new array on the heap with '-' in it, I think
there is a way, but I'm not sure how to do it. I'm pretty sure there's
a
runtime funct
On Fri, 30 Jul 2010 11:35:15 -0400, Steven Schveighoffer
wrote:
>
> On Fri, 30 Jul 2010 11:24:41 -0400, dcoder wrote:
>
> > Hello.
> >
> > Is there anyway in D to convenient fill a string variable with a char
> > say X times?
> >
> > So, I'd like to do something like:
> >
> > string divider(
On Fri, 30 Jul 2010 11:24:41 -0400, dcoder wrote:
Hello.
Is there anyway in D to convenient fill a string variable with a char
say X times?
So, I'd like to do something like:
string divider( size, '-');// C++ notation.
$divider = '-' x $size;// perl notation.
I thought I cou
Hello.
Is there anyway in D to convenient fill a string variable with a char say X
times?
So, I'd like to do something like:
string divider( size, '-');// C++ notation.
$divider = '-' x $size;// perl notation.
I thought I could do the following:
const char divider[rowstr.length]
20 matches
Mail list logo