15,306,245 members

# The Weird and The Wonderful

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 Re: How to zero-pad a number? PIEBALDconsult1-Oct-13 6:27 PIEBALDconsult 1-Oct-13 6:27
 Re: How to zero-pad a number? Richard Deeming1-Oct-13 7:09 Richard Deeming 1-Oct-13 7:09
 Re: How to zero-pad a number? PIEBALDconsult1-Oct-13 10:43 PIEBALDconsult 1-Oct-13 10:43
 Re: How to zero-pad a number? Richard Deeming1-Oct-13 10:57 Richard Deeming 1-Oct-13 10:57
 Re: How to zero-pad a number? Big Daddy Farang1-Oct-13 11:23 Big Daddy Farang 1-Oct-13 11:23
 Re: How to zero-pad a number? PIEBALDconsult1-Oct-13 13:44 PIEBALDconsult 1-Oct-13 13:44
 Re: How to zero-pad a number? Richard Deeming2-Oct-13 1:44 Richard Deeming 2-Oct-13 1:44
 Re: How to zero-pad a number? SortaCore2-Oct-13 2:07 SortaCore 2-Oct-13 2:07
 PIEBALDconsult wrote:I'm fairly sure that no self-respecting C# professional uses it that way.Heh, I go for the shorter version. If it doesn't make sense with a mishmash of ints/strings I use brackets or ToString() to clarify. C#Copy Code ```int i = 124, j = 253; string s = "JD" + i + j; // Could be two things and no one wants to look up operator precedence, so instead... string t = "JD" + (i + j);``` But yeah, usually I don't bother. Although, theoretically, I could now do C#Copy Code ```string s = 0; // won't initialise string t = "" + 0; // will work fine O.o``` So, let's get back to self-respecting...
 Re: How to zero-pad a number? PIEBALDconsult2-Oct-13 3:12 PIEBALDconsult 2-Oct-13 3:12
 Re: How to zero-pad a number? Richard Deeming2-Oct-13 3:19 Richard Deeming 2-Oct-13 3:19
 Re: How to zero-pad a number? PIEBALDconsult2-Oct-13 3:28 PIEBALDconsult 2-Oct-13 3:28
 Re: How to zero-pad a number? SortaCore2-Oct-13 9:21 SortaCore 2-Oct-13 9:21
 Re: How to zero-pad a number? SortaCore1-Oct-13 10:48 SortaCore 1-Oct-13 10:48
 Re: How to zero-pad a number? Dennis_E2-Oct-13 23:19 Dennis_E 2-Oct-13 23:19
 That really makes a difference mav.northwind26-Sep-13 20:51 mav.northwind 26-Sep-13 20:51
 Re: That really makes a difference GuyThiebaut2-Oct-13 5:31 GuyThiebaut 2-Oct-13 5:31
 Re: That really makes a difference Athari7-Oct-13 6:50 Athari 7-Oct-13 6:50
 Can I copy that? BotCar25-Sep-13 2:32 BotCar 25-Sep-13 2:32
 Re: Can I copy that? Pete O'Hanlon25-Sep-13 2:46 Pete O'Hanlon 25-Sep-13 2:46
 Re: Can I copy that? Nicholas Marty25-Sep-13 4:12 Nicholas Marty 25-Sep-13 4:12
 Why is my code so slow?? vonb24-Sep-13 1:39 vonb 24-Sep-13 1:39
 Re: Why is my code so slow?? Jörgen Andersson24-Sep-13 4:30 Jörgen Andersson 24-Sep-13 4:30
 Re: Why is my code so slow?? vonb24-Sep-13 4:37 vonb 24-Sep-13 4:37
 Re: Why is my code so slow?? Jörgen Andersson24-Sep-13 8:32 Jörgen Andersson 24-Sep-13 8:32
 Re: Why is my code so slow?? Rage24-Sep-13 5:15 Rage 24-Sep-13 5:15
 Last Visit: 31-Dec-99 18:00     Last Update: 21-May-22 8:52 Refresh ᐊ Prev1...240241242243244245246247248249 Next ᐅ

General    News    Suggestion    Question    Bug    Answer    Joke    Praise    Rant    Admin

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.