Off the top of my head, if you’re using STL then do this:
string firstLetter(1,str[0]);
More Related Contents:
- C++ double char array deliminator [closed]
- “\n” or ‘\n’ or std::endl to std::cout? [duplicate]
- For every character in string
- How to remove certain characters from a string in C++?
- Difference between using character pointers and character arrays
- How to Read from a Text File, Character by Character in C++
- How Can I avoid char input for an int variable?
- When do I use fabs and when is it sufficient to use std::abs?
- Getting a directory name from a filename
- How to use C++ std::ostream with printf-like formatting?
- How to prevent non-specialized template instantiation?
- Can a variable be declared both static and extern?
- SVM classifier based on HOG features for “object detection” in OpenCV
- Specification of source charset encoding in MSVC++, like gcc “-finput-charset=CharSet”
- How to read input when debugging in C++ in Visual Studio Code?
- How to embed the GNU Octave in C/C++ program?
- How to use typelists
- Can a copy-constructor take a non-const parameter?
- What’s the best way to cast a function pointer from one type to another?
- C++ uniform_int_distribution always returning min() on first invocation
- Regex not working as expected with C++ regex_match
- Explicit Type Conversion and Multiple Simple Type Specifiers
- using sendmessage to send wm_close to another process
- _iterator_debug_level value ‘0’ doesn’t match value ‘2’
- SDL 2 Undefined Reference to “WinMain@16” and several SDL functions
- Can using a lambda in header files violate the ODR?
- Default template argument and partial specialization
- Can I use const in vectors to allow adding elements, but not modifications to the already added?
- friend declaration declares a non-template function [duplicate]
- template parameter packs access Nth type and Nth element