Code Comments
Programming Forum and web based access to our favorite programming groups.On 1 Nov, 03:40, "Pete Dashwood" <dashw...@removethis.enternet.co.nz> wrote: > "Robert" <n...@e.mail> wrote in message > > news:6c8ii3t6r3qr5uhed8mkts2bnamllk8oj4@ 4ax.com... > > > > > > > > > > > > An imaginative solution, Robert. > > I still prefer: > > RegEx.Replace(inputString, @"\s\w+\s", " ") ; > > ... which does exactly what the user requested (same as the above), with a > single statement. > > The parameters to the "Replace" function are in 3 parts: > > 1. The input string. > 2. The Regular Expression to be matched. > 3. The string to replace whatever is matched. (This does NOT have to be th e > same length as what is matched; it can be longer or shorter.) > > "Translation": > @ = what follows is a "verbatim string"; it doesn't need to have slashes > escaped. This is a C# feature, not part of RegEx. > \s = match a single white space > \w = match a single alphanumeric character (the "w" stands for "word") > + = there MUST be 1, and CAN be many, of the preceding character. > > Lastly, the statement specifies that anything found to match, is to be > replaced by a single space character. > > So, ' x ' would match, ' x' would not; ' xxxcv13ed5 ' would match, ' > xxxcv$3ed5 ' would not, and so on... > > Pete. > -- > "I used to write COBOL...now I can do anything."- Hide quoted text - > > - Show quoted text - You both failed the GOOD PROGRAMMERS test as neither of you put appropriate comments in with your code. :-P
Post Follow-up to this message"Alistair" <alistair@ld50macca.demon.co.uk> wrote in message news:1193919592.787611.131630@z9g2000hsf.googlegroups.com... > On 1 Nov, 03:40, "Pete Dashwood" <dashw...@removethis.enternet.co.nz> > wrote: > > You both failed the GOOD PROGRAMMERS test as neither of you put > appropriate comments in with your code. :-P > Do you comment every MOVE statement you write in COBOL? To a C# or ORACLE Programmer the forms used are as clear as a MOVE statement would be to a COBOL Programmer. If you "know the language" then documentation needs to be done at a CONCEPTUAL level, not at the nitty gritty level. In fact documenting at too low a level simpy makes your code verbose and difficult to read. And who told you that GOOD PROGRAMMERS put "appropriate comments" in with their code? GOOD PROGRAMMERS write code that speaks for itself to another programmer, and document only the tricky or unusal stuff. Production code is not intended to be a tutorial for people who are not qualified to maintain it, or haven't earned the language in use. Pete. -- "I used to write COBOL...now I can do anything."
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.