Multiple %s format specifiers with a single argument
import std.string; void main() { string foo = "foo"; string bar = format("%s %s %s", foo); } format expects 3 arguments, but what I really want is foo to be used for all 3 specifiers and not repeat 'foo' 3 times manually. Are there any format specifiers that do what I want? I've tried using positional specifiers but that didn't work: string bar = format("%1$s %1$s %1$s", foo); $ std.format.FormatException@std\format.d(4363): string That's a great error message btw.
Re: Multiple %s format specifiers with a single argument
On Monday, 9 April 2012 at 17:09:03 UTC, Andrej Mitrovic wrote: import std.string; void main() { string foo = "foo"; string bar = format("%s %s %s", foo); } format expects 3 arguments, but what I really want is foo to be used for all 3 specifiers and not repeat 'foo' 3 times manually. Are there any format specifiers that do what I want? I've tried using positional specifiers but that didn't work: string bar = format("%1$s %1$s %1$s", foo); $ std.format.FormatException@std\format.d(4363): string That's a great error message btw. Positional specifier works just fine for me.
Re: Multiple %s format specifiers with a single argument
On 4/9/12, q66 wrote: > Positional specifier works just fine for me. Which version are you using? I'm on 2.058.
Re: Multiple %s format specifiers with a single argument
On Monday, April 09, 2012 19:08:54 Andrej Mitrovic wrote: > import std.string; > > void main() > { > string foo = "foo"; > string bar = format("%s %s %s", foo); > } > > format expects 3 arguments, but what I really want is foo to be used > for all 3 specifiers and not repeat 'foo' 3 times manually. Are there > any format specifiers that do what I want? I've tried using positional > specifiers but that didn't work: > > string bar = format("%1$s %1$s %1$s", foo); > $ std.format.FormatException@std\format.d(4363): string > > That's a great error message btw. Posix positional arguments seem to work for writefln but not format for whatever reason. Report it as a bug. - Jonathan M Davis
Re: Multiple %s format specifiers with a single argument
On 4/9/12, Jonathan M Davis wrote: > Posix positional arguments seem to work for writefln but not format for > whatever reason. Report it as a bug. Thanks, http://d.puremagic.com/issues/show_bug.cgi?id=7877
Re: Multiple %s format specifiers with a single argument
On 04/09/2012 10:24 AM, Andrej Mitrovic wrote: On 4/9/12, q66 wrote: Positional specifier works just fine for me. Which version are you using? I'm on 2.058. Positional parameters[*] are supported in 2.058. This example prints the same argument in decimal, hexadecimal, octal, and binary: writefln("%1$d %1$x %1$o %1$b", 42); Ali [*] http://ddili.org/ders/d.en/formatted_output.html
Re: Multiple %s format specifiers with a single argument
On 04/09/2012 10:35 AM, Andrej Mitrovic wrote: On 4/9/12, Jonathan M Davis wrote: Posix positional arguments seem to work for writefln but not format for whatever reason. Report it as a bug. Thanks, http://d.puremagic.com/issues/show_bug.cgi?id=7877 Thanks. I hadn't seen this branch of the thread before sending my response. Some newsgroup software break threads into multiple branches. Could be my Thunderbird... (?) Ali
Re: Multiple %s format specifiers with a single argument
On Monday, 9 April 2012 at 17:24:35 UTC, Andrej Mitrovic wrote: On 4/9/12, q66 wrote: Positional specifier works just fine for me. Which version are you using? I'm on 2.058. git
Re: Multiple %s format specifiers with a single argument
On 4/10/2012 3:43 AM, Ali Çehreli wrote: On 04/09/2012 10:35 AM, Andrej Mitrovic wrote: On 4/9/12, Jonathan M Davis wrote: Posix positional arguments seem to work for writefln but not format for whatever reason. Report it as a bug. Thanks, http://d.puremagic.com/issues/show_bug.cgi?id=7877 Thanks. I hadn't seen this branch of the thread before sending my response. Some newsgroup software break threads into multiple branches. Could be my Thunderbird... (?) Ali It's not Thunderbird. IIRC it's an issue with some users posting via the email interface.
Re: Multiple %s format specifiers with a single argument
On 09/04/2012 18:35, Andrej Mitrovic wrote: On 4/9/12, Jonathan M Davis wrote: Posix positional arguments seem to work for writefln but not format for whatever reason. Report it as a bug. Thanks, http://d.puremagic.com/issues/show_bug.cgi?id=7877 Andrej, are emails from Bugzilla not getting through to you? And Jonathan, you ought to know that you already submitted one of the duplicate bug reports about this. You shouldn't submit bug reports without searching first anyway. Always include resolved bugs in the search - the bug you're about to report might have been fixed ready for the next release, and duplicates already in the system help to catch different ways of phrasing the same statement, among other things. Stewart.
Re: Multiple %s format specifiers with a single argument
On 4/10/12, Stewart Gordon wrote: > Andrej, are emails from Bugzilla not getting through to you? I'm not getting any emails. Bugzilla stopped emailing me for quite a while now, I don't know why (except the monthly password reminder). The emails page has all the ticks set except this row: "The issue is in the UNCONFIRMED state ". I've clicked the Enable All Email button just now and it unselected all ticks from the row "The change was made by me ", but I don't think that was causing bugzilla to stop mailing me. >On 4/10/12, Stewart Gordon wrote: > You shouldn't submit bug reports without searching first anyway. I did, but the default search box doesn't seem to search duplicate reports (I didn't know this until now). E.g. if I search for "format positional" I get this lone result: http://d.puremagic.com/issues/buglist.cgi?quicksearch=format+positional But with an advanced search the reports do show up: http://d.puremagic.com/issues/buglist.cgi?query_format=advanced&short_desc=format%20positional&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=RESOLVED&bug_status=VERIFIED&bug_status=CLOSED&short_desc_type=allwordssubstr&component=Phobos&product=D There's an option in advanced search "and remember these as my default search options", but even though I have this ticked and it says it saved it, it doesn't actually work.
Re: Multiple %s format specifiers with a single argument
On 4/10/12, Andrej Mitrovic wrote: > E.g. if I search for "format > positional" I get this lone result: > > http://d.puremagic.com/issues/buglist.cgi?quicksearch=format+positional I mean this result: http://d.puremagic.com/issues/show_bug.cgi?id=4927
Re: Multiple %s format specifiers with a single argument
On Tuesday, April 10, 2012 13:06:08 Stewart Gordon wrote: > On 09/04/2012 18:35, Andrej Mitrovic wrote: > > On 4/9/12, Jonathan M Davis wrote: > >> Posix positional arguments seem to work for writefln but not format for > >> whatever reason. Report it as a bug. > > > > Thanks, http://d.puremagic.com/issues/show_bug.cgi?id=7877 > > Andrej, are emails from Bugzilla not getting through to you? > > And Jonathan, you ought to know that you already submitted one of the > duplicate bug reports about this. LOL. There's no way that I'd remember all of the bug reports that I've filed. I haven't filed anywhere near as many as Bearophile has, but I've filed quite a a few, and unless a problem is one that I run into regularly or comes up regularly in the newsgroup, I'm not likely to remember that it exists, let alone that I reported it. - Jonathan M Davis
Re: Multiple %s format specifiers with a single argument
On 10/04/2012 13:30, Andrej Mitrovic wrote: On 4/10/12, Stewart Gordon wrote: Andrej, are emails from Bugzilla not getting through to you? I'm not getting any emails. Bugzilla stopped emailing me for quite a while now, I don't know why (except the monthly password reminder). Assuming that you did hit the "Submit Changes" button and that the email address you have registered with Bugzilla is correct, I don't know. Have you checked with your email provider to see if they're being flagged as spam? On 4/10/12, Stewart Gordon wrote: You shouldn't submit bug reports without searching first anyway. I did, but the default search box doesn't seem to search duplicate reports (I didn't know this until now). E.g. if I search for "format positional" I get this lone result: http://d.puremagic.com/issues/buglist.cgi?quicksearch=format+positional Indeed, it seems that quick search is designed only as a means of quickly finding an open bug that you know is in the system. There's an option in advanced search "and remember these as my default search options", but even though I have this ticked and it says it saved it, it doesn't actually work. It seems that "and remember these as my default search options" affects only the advanced search. Or are you finding that it isn't working even there? Stewart.
Re: Multiple %s format specifiers with a single argument
On 4/10/12, Stewart Gordon wrote: > Assuming that you did hit the "Submit Changes" button and that the email > address you have registered with Bugzilla is correct, I don't know. > Have you checked with your email provider to see if they're being > flagged as spam? Looks like you're right, it's in spam. I don't get Google, apparently "your email won 1.000.000$" is not spam, but mails from "d-bugm...@puremagic.com" are marked as spam. I'll have to add that mail to the whitelist. > It seems that "and remember these as my default search options" affects > only the advanced search. I see. I assumed "default search" meant the search box at the top. Oh well, lesson learned. :)
Re: Multiple %s format specifiers with a single argument
* Mike Parker [2012-04-10 18:46:42 +0900]: > On 4/10/2012 3:43 AM, Ali Çehreli wrote: > >On 04/09/2012 10:35 AM, Andrej Mitrovic wrote: > >>On 4/9/12, Jonathan M Davis wrote: > >>>Posix positional arguments seem to work for writefln but not format for > >>>whatever reason. Report it as a bug. > >> > >>Thanks, http://d.puremagic.com/issues/show_bug.cgi?id=7877 > > > >Thanks. I hadn't seen this branch of the thread before sending my > >response. Some newsgroup software break threads into multiple branches. > >Could be my Thunderbird... (?) > > > >Ali > > It's not Thunderbird. IIRC it's an issue with some users posting via > the email interface. > Its less using the email interface, and more people using braindead email clients. Gmail and Mutt (the two I use most) seem to handle replying well, setting the correct headers to indicate things. But I've seen some odd postings from people posting using things like Windows Live Mail. And it seems that Outlook Express is better at mailing lists than Outlook, which is strange... -- James Miller
Re: Multiple %s format specifiers with a single argument
Am Thu, 12 Apr 2012 13:11:16 +1200 schrieb James Miller : > Its less using the email interface, and more people using braindead > email clients. Gmail and Mutt (the two I use most) seem to handle > replying well, setting the correct headers to indicate things. But I've > seen some odd postings from people posting using things like Windows > Live Mail. And it seems that Outlook Express is better at mailing lists > than Outlook, which is strange... > > -- > James Miller Well, I found Claws-Mail to actually fix up behind broken mail clients, by merging discussions with the same title. I switched from Opera to CM a while ago. It also offers a search by a list of criteria that downloads missing message bodies lazily on a full-text search. It starts up almost instantly, but takes a few seconds to load the 160.000 messages of this group, fixing up split discussions on the way. ;) Also I found that Opera Mail had a good set of default settings, while in Claws it took me a while to understand its configuration options. Haven't tried other clients (except for Evolution, which was no improvement over Opera). -- Marco