Re: regex

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi Jon,

I suppose pedantry has its place. These details are always useful to know.
In my case, I was simply talking about looping through the characters in the
string as an efficient way of counting the occurrences of a character.
However, it might have led to someone getting the wrong impression
concerning what ways one might be able to treat a string as if it were an
array of char. So, I don't take offense. I do think my solution was probably
the most efficient method for achieving the OP's goal, though. I hope that
the original problem has been solved.

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"Jon Skeet [C# MVP]" <skeet@xxxxxxxxx> wrote in message
news:1186572194.199261.325440@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Aug 8, 12:17 pm, "Kevin Spencer" <unclechut...@xxxxxxxxxxxx> wrote:
Correct as usual, Jon. I should have said "a string encapsulates an array
of
char, and can be treated just like one."

I think I'd still have quibbled: internally there isn't an array of
chars (unlike in Java, for instance) and you can't treat it as an
array of chars because you can always modify the contents of arrays,
whereas the string indexer is readonly.

There's always room for pedantry :)

Jon



.



Relevant Pages

  • Re: How to best parse a CSV data file and do a lookup in C?
    ... > and build an array for each line seperating on the commas. ... that you either change its type to "static char" (otherwise the ... making fscanfread a maximum number of 128 characters as long ... that must be a comma or a newline. ...
    (comp.lang.c)
  • Re: Sorry, newbie question about generating a random string
    ... string grows to a max of 10 characters. ... The real problem is that you are not terminating the string. ... string is an array of characters ending in a null character, ... char myChar; ...
    (comp.lang.c.moderated)
  • Re: How to zero-initialize a C string (array of wchar_t)?
    ... you need to fill the array with '\0' because if the array is of dimension ... because the 5-6-7-8 characters were not set and are still using unset ... is almost impossible to overflow... ... if you allocated 10 char and the user input ...
    (comp.lang.cpp)
  • Re: difference for array in c and c++?
    ... functions take an 8-byte char array to indicate which module you ... remainder of the array with null characters is wasteful. ... The strncpy function copies not more than n characters ...
    (comp.lang.c)
  • Re: heeeeeeeeeeeeeeeellllllllllllllppppppppppppppppppppp
    ... Why is using char* a bad thing and why using sprintf a bad thing to, ... can be up to MAX_PATH characters). ... LPSTR lpMsgBuf; ... MessageBox(NULL, lpMsgBuf, "GetLastError() for ...
    (microsoft.public.vc.mfc)