|
-
March 30th, 2009, 01:44 PM
#1
How to select characters in string?
So I'm working heavilly with Python right now, and one thing you can do it parse/select string pretty easily.
For example, if you wanted to create a variable and display a few letters, it'd be:
text = "Hello"
yo = text[1:4]
print yo
Output = "ell"
This seems simple, and to an extent I see it possible in C++. But all I can find is how to select a specific one character, using it like this:
string text = "Hello";
cout << text[1];
Output = "e"
But is there a way to do this selection with multiple characters, as I did in the Python example?
Thanks in advance for any help!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|