cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
Extracting letters
Extracting letters
Oct 3, 2013 at 11:54am UTC
Ozwurld
(64)
Does anyone know how i could go about extracting and checking if the very first character in my string array is an alphabet
PLease Help
Thnx
Oct 3, 2013 at 12:00pm UTC
closed account (
o3hC5Di1
)
Hi there,
You probably need either isalnum() or isalpha() from the <cctype> header:
http://www.cplusplus.com/reference/cctype/
If you are using std::string you can access individual characters by using the subscript dereference operator []:
1
2
3
std::string test(
"foo"
); std::cout << test[0];
//prints 'f'
Hope that helps.
All the best,
NwN
Oct 3, 2013 at 1:13pm UTC
kulkarnisr
(91)
http://www.cplusplus.com/reference/cctype/isalpha/
Topic archived. No new replies allowed.