Timeline for Excel VBA code midStr() function using left and right position instead of length used with mid()
Current License: CC BY-SA 4.0
        8 events
    
    | when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 1, 2021 at 23:22 | comment | added | Mark Main | thanks, I do the same thing, i typically use r and c for the row and columns; i tend to use i, and i2 for simple indexing, and i'll generally just use 'a' for any quick string manipulation. single letters are nice when it's obvious they are used in a short block of code. I notice that the parameters for Excel use all lower_case with the underscore, and the name of the function seems to be all upper case. | |
| Apr 1, 2021 at 23:03 | comment | added | TinMan | @MarkMain I have one caveat to using Pascal Case. I do not use it for simple counters. For counters I use r and c for rows and columns lowercase letters for everything else. | |
| Apr 1, 2021 at 22:23 | comment | added | Mark Main | Thank you for the suggestions. I will take the advice given by many to use StartIndex and EndIndex instead of LeftPos and RightPos. My current design allows any number to pass, and as long as StartPos <= EndPos then some character(s) will be returned, if not then NULL. But, I agree, defaulting to zero eliminates some error potential, and it does not limit the code at all, so I'll make that change. I also really appreciate the comments regarding PascalCase vs camelCase vs UPPER_CASE. I've never seen a dialog on the subject and so I plan to change to what is more standard. | |
| Apr 1, 2021 at 10:08 | comment | added | Cristian Buse | Indeed, absolutely annoying to have VBA lowercasing method names because a variable with same name is defined somewhere or vice versa. I found myself adding a _ at the end of the common variable names (value_, key_) but is ugly and I don't like it. I will consider PascalCase for everything | |
| Mar 31, 2021 at 23:47 | comment | added | Mathieu Guindon | To be fair, having a clean source control diff wasn't much of a concern back then :) | |
| Mar 31, 2021 at 23:40 | comment | added | TinMan | @MathieuGuindon you would know better that I do. I suspect that they originally did this to improve performance. In truth, I would hate to be the one responsible for fixing this nuisance and taking the heat for any new bug that comes along. Thanks for the ↑vote↑. | |
| Mar 31, 2021 at 23:06 | comment | added | Mathieu Guindon | 
        
            
    I've semi-recently adopted PascalCaseEverywhere and haven't looked back since (had adopted camelCaseForLocals from years of C# influencing my VB style!). As for MS fixing it, I could be wrong but my understanding is that it's not something that's possible without rewriting how VBA caches in-scope names ...to make them case-sensitive.
        
     | 
|
| Mar 31, 2021 at 22:18 | history | answered | TinMan | CC BY-SA 4.0 |