Linked Questions
61 questions linked to/from Convert a String In C++ To Upper Case
4 votes
1 answer
16k views
How to convert std::string to upper case? [duplicate]
I want to convert a std::string to uppercase. I am aware of the function toupper(), however in the past I have had issues with this function and it is hardly ideal anyway as use with a string would ...
1 vote
3 answers
2k views
c++ toupper - standard function? [duplicate]
Possible Duplicate: Convert a String In C++ To Upper Case Hi, I need a portable function to convert string in c++ to upper case. I'm now using toupper( char); function. Is it a standard function? ...
1 vote
2 answers
349 views
A function to replace an element in a string with another element [duplicate]
I want to replace all of the Uppercase letters in string with lowercase letters is there any function to do so because the replace function is not giving any result. Here is my code.. for (int i = ...
0 votes
1 answer
237 views
Returning null char array with rewriting Java's String.toUpperCase() [duplicate]
I am originally a Java programmer and I have a deep love of the syntax, especially regarding the String object. With C++, I have tried to recreate the toUpperCase() method that Java has. The only ...
-6 votes
1 answer
233 views
How to put string in all caps? [duplicate]
I'm working on a side assignment for fun and want to capitalize the output from whatever the user entered using ::toupper but I'm struggling. This is what I have so far; #include <cctype> #...
0 votes
1 answer
105 views
How do I convert a string I get from a function from an external file to all upper case [duplicate]
I am writing a program that can count the number of times a word is found in a external file. The words that are to be searched for are also in an external file but I am able to retrieve those just ...
147 votes
10 answers
22k views
What is the idea behind ^= 32, that converts lowercase letters to upper and vice versa?
I was solving some problem on codeforces. Normally I first check if the character is upper or lower English letter then subtract or add 32 to convert it to the corresponding letter. But I found ...
211 votes
6 answers
145k views
Is char signed or unsigned by default?
In the book "Complete Reference of C" it is mentioned that char is by default unsigned. But I am trying to verify this with GCC as well as Visual Studio. It is taking it as signed by default. Which ...
30 votes
25 answers
20k views
What are some tricks I can use with macros? [closed]
In our legacy code, as well as our modern code, we use macros to perform nifty solutions like code generations, etc. And we make use of both the # and ## operators. I am curious how other developers ...
39 votes
7 answers
155k views
How to Convert a C++ String to Uppercase
I need to convert a string in C++ to full upper case. I've been searching for a while and found one way to do it: #include <iostream> #include <algorithm> #include <string> ...
6 votes
17 answers
2k views
What is the fastest way to decide if a digit appears in a string?
This simple solution popped into my mind quickly. #include <ctype.h> int digit_exists_in ( const char *s ) { while (*s) { if (isdigit(*s)) { return 1; ...
20 votes
10 answers
25k views
Convert a unicode String In C++ To Upper Case
How we can convert a multi language string or unicode string to upper/lower case in C or C++.
51 votes
2 answers
6k views
Is it safe to read past the end of a buffer within the same page on x86 and x64?
Many methods found in high-performance algorithms could be (and are) simplified if they were allowed to read a small amount past the end of input buffers. Here, "small amount" generally ...
8 votes
9 answers
65k views
Error: Range-based 'for' loops are not allowed in C++98 mode
So I'm following the tutorials on this page: http://www.cplusplus.com/doc/tutorial/control/ But I'm having trouble doing a range/based for loop. I found this page: GNU GCC compiler updatingThe answer ...
13 votes
3 answers
8k views
Can I use SIMD for speeding up string manipulation?
Are SIMD instructions built for vector numerical calculations only? Or does it lend itself well to a class of string manipulation tasks like, writing rows of data to a text file where the order of the ...