Timeline for A CSharpish String.Format formatting helper
Current License: CC BY-SA 3.0
        15 events
    
    | when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Sep 22, 2021 at 9:25 | comment | added | Greedo | 
        
            
    I think I already mentioned to you Matt but I was reminded of this recently. I resurrected this code and put it on github, and also here is a downloadable .xlam version which can be referenced from an excel project, and gives both StringFormat (updated) and FormerStringFormat (original) functions. I seem to remember the escape sequences may not be working correctly, I had to make some guesses, but this is 90% of the way there
        
     | 
|
| Jun 5, 2018 at 18:57 | comment | added | Mathieu Guindon | @Greedo I had it all on an old computer.. which died in 2015. This is all that's left of it :-/ the original function on the SO post is self-contained though, no? | |
| Jun 5, 2018 at 18:56 | comment | added | Greedo | I would like to use this code because it's darn fantastic. However you've missed some of the definitions out for the sake of the review, and so as it stands I can't use this fully. Would you be willing to share the complete code or provide a link to it? Maybe a cheeky .xlam ;) if it's kicking around | |
| Sep 12, 2013 at 19:18 | vote | accept | Mathieu Guindon | ||
| Sep 10, 2013 at 1:00 | comment | added | Jamal | In that case, there would have to be another answer to review that answer. Answerception? | |
| Sep 10, 2013 at 0:56 | comment | added | Mathieu Guindon | I'm sure there are a couple nasty bugs lurking in there... The thing with a self-answer on CR is that the self-answer could be subject to another code review on its own - self-answering sounds like saying "okay nevermind what's above; I made it better, take a look at this instead"... interestingly, "self-answer" yields only 2 irrelevant results on meta... | |
| Sep 10, 2013 at 0:47 | comment | added | Jamal | As this IS an answer, no one can properly do a full review if needed. Any criticisms and such would be limited to comments. Moreover, don't be afraid to self-answer (as long as it's still intended to be an answer). I've done so before, but haven't received votes on any of them. I think it's kinda hard to self-answer on CR, especially if you yourself can't figure out one of the best reviewed versions of your code. | |
| Sep 10, 2013 at 0:40 | comment | added | Mathieu Guindon | Thanks! Check this out: msdn.microsoft.com/en-us/library/fht0f5be(v=vs.95).aspx - I think this implementation is the most useful code I've ever written in VB6 (works in VBA - Alt+F11 in Excel, insert a new code module and enjoy .net-like string formatting :)). I didn't really mean to self-answer, it's just rewriting it in a more OOP way was itching... so I figured I'd post the refactored version as a self-answer, but I'm not self-accepting it just yet - in case I actually get a review... I take it as some sort of "practice review" :) | |
| Sep 10, 2013 at 0:31 | comment | added | Jamal | And I thought Winston Ewert was the only one here with the longest answers. :-P Kudos for such a lengthy (and assumably great) self-answer contribution. It's a shame I have no idea what any of this means. | |
| Sep 10, 2013 at 0:28 | history | edited | Mathieu Guindon | CC BY-SA 3.0 | 
        
            
             
                
                    Improved formatting & readability, added key points & more meat overall. 
                
             
        
     | 
| Sep 9, 2013 at 18:52 | comment | added | Mathieu Guindon | 
        
            
    I should add that performance tests calling StringFormat("{0,20}", "test string") 10,000 times in a loop, with the monolithic function average at around 2730 (2703-2797) milliseconds, while the refactored and definitely more object-oriented version averages at around 2390 (2312-2594) milliseconds, which is a subtle but welcome improvement!
        
     | 
|
| Sep 9, 2013 at 17:21 | history | edited | Mathieu Guindon | CC BY-SA 3.0 | 
        
            
             
                
                    removed redundant hex specifier replacement 
                
             
        
     | 
| Sep 9, 2013 at 17:11 | history | edited | Mathieu Guindon | CC BY-SA 3.0 | 
        
            
             
                
                    fixed bug with double-backslash / escaped backslashes 
                
             
        
     | 
| Sep 9, 2013 at 16:31 | history | edited | Mathieu Guindon | CC BY-SA 3.0 | 
        
            
             
                
                    fixed bug with alignment 
                
             
        
     | 
| Sep 9, 2013 at 16:20 | history | answered | Mathieu Guindon | CC BY-SA 3.0 |