What I am trying to do is get the first letter from a person's name using the substr function, and then change the letter to lowercase. This is my code to do that:
firstLetter = final_last_name.substr(0, 1);
firstLetter = static_cast<string>(tolower(firstLetter));
Every time I try to compile the program, it gives me this error message:
error C2664: 'tolower' : cannot convert parameter 1 from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' to 'int'
I am using the header file cctype for the function tolower, and I have tried changing that "char" inside the static cast to "string" since I am manipulating strings in this program, but nothing seems to budge.
Any ideas would be appreciated. Thanks.
>Any ideas would be appreciated.
Assuming firstLetter is suitably declared.
firstLetter = tolower ( final_last_name );
Ah, I thought I would have to keep static_casting to change it to a lower case letter. I guess I keep forgetting that static casting is only for changing a data type.
I appreciate your help.