cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
user name:
password:
Forgot your password?
please wait
try again
cancel
forgot your password?
sign up
log in
[Legacy version]
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Breaking up a string
Breaking up a string
Mar 12, 2009 at 6:55pm
Mar 12, 2009 at 6:55pm UTC
belkdaddy
(15)
Hi I need a simple way to break up one string into several strings. An example of what i need is to turn the string "golf" into four different strings, "g", "o", "l", "f".
If anyone knows how to do this it would be greatly appreciated.
Mar 12, 2009 at 7:04pm
Mar 12, 2009 at 7:04pm UTC
jsmith
(5804)
Given
string foo = "Hello World"
or
char foo[] = "Hello World"
foo[0] returns the 0th character in the word.
Loop until foo.length() - 1 (string case) or strlen( foo ) (char* case)
Topic archived. No new replies allowed.