View Single Post
Old Jun 3rd, 2006, 7:44 PM   #6
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Your question isn't really clear. That's why all your answerees are saying, "you meant so-and-so, right?) If you mean, find a substring, Jesse has what you need (unless you just want to roll your own). As Animatronic says, if you just want to get at a specified position in a string, what's wrong with myString [specifiedPosition]? If you want to find a character, there are such things as strchr and ilk. Pay no attention to Serinth's solution, which is just trash. I see no reason to use pointer arithmetic to increment a string's pointer up to what you want when you can go straight there, if you know what you want. If you don't know what you want, you're up shit creek, anyway.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote