In C / C++ tolower function converts a given character to lowercase according to the character conversion rules defined by the currently installed C locale. In the default "C" locale, the following uppercase letters ABCDEFGHIJKLMNOPQRSTUVWXYZ are replaced with respective lowercase letters abcdefghijklmnopqrstuvwxyz.
Questions tagged [tolower]
148 questions
5
votes
5 answers
Why avoid string.ToLower() when doing case-insensitive string comparisons?
I have read that when in your application you do a lot of string comparison and using ToLower method, this method is quite costly. I was wondering of anyone could explain to me how is it costly. Would appreciate any info or explanation. Thanks!

Coding Duchess
- 6,445
- 20
- 113
- 209
5
votes
3 answers
How to set a string to all lowercase
I have a char foo[SIZE]; //(string)
and have inputed it correctly using %s (as in it printfs the correct input), but now want to set it to lowercase. So I tried using
if (isupper(*foo))
*foo=tolower(*foo);
ie when I do:
printf("%s" foo);…

user2450044
- 59
- 1
- 1
- 3
4
votes
2 answers
tolower() is not working for Ü,Ö in c++
When I tried tolower() with non english charecters in c++ it's not working normally. I searched that issue and I came across something about locale but I am not sure about best solution of that.
My sample code is below:
printf("%c ",tolower('Ü'));

Yavuz
- 1,257
- 1
- 16
- 32
3
votes
2 answers
::tolower using std::transform
Why std::transform doesn't work this way:
std::string tmp = "WELCOME";
std::string out = "";
std::transform(tmp.begin(), tmp.end(), out.begin(), ::tolower);
out is empty!
But this works:
std::transform(tmp.begin(), tmp.end(), tmp.begin(),…

Xigma
- 177
- 1
- 11
3
votes
1 answer
lemmatization of german words (Capital letters and lower case letters)
I would like to lemmatize a list of German words, including nouns and verbs. The struggle here is that this implies words beginning with capital letters and others with lower case letters. Until now I worked with a lookup list. Here, the…

wwnpo01
- 75
- 6
3
votes
1 answer
How to change string case in NIM?
In NIM 0.17 toLower is deprecated.
So, what would be the proper way of changing the case of a string in NIM?

alec_djinn
- 10,104
- 8
- 46
- 71
3
votes
3 answers
How to use tolower() with char*?
I have a .txt file with some words and I need them to be lowercase.
How to make each word lowercase? Just adding tolower() to strtok() doesn't work. What should I add? Or maybe it would be easier to use tolower() on whole file firstly? But how?…

PoorProgrammer
- 111
- 1
- 2
- 9
3
votes
2 answers
golang selective conversion of string to lower case
I am working with an ldap object where I am retrieving some entries from Activedirectory. The results are in such a way that the realm is returned in uppercase, like CN=bob,DC=example,DC=com instead of cn=bob,dc=example,dc=com. Is there a way to…

scott
- 1,557
- 3
- 15
- 31
3
votes
2 answers
Converting a cstring to camelcase
So my task is to fill out my function to work with a test driver that feeds it a random string during every run. For this function I have to convert the first character of every word to a capital and everything else must be lower.
It mostly works…

RyeMan
- 35
- 2
- 6
3
votes
3 answers
How to convert a string (char *) to upper or lower case in C
I have a struct:
typedef struct entry {
char *surname;
int house_no;
char *postcode;
} BEntry;
and a function to convert strings to upper case:
void toUpper(char *str){
while (*str != '\0')
{
*str = toupper(*str);
str++;
…

Highway62
- 800
- 1
- 10
- 25
3
votes
1 answer
odata : how to use tolower in startswith
When I use odata like this: $filter=startswith(tolower(firstName),tolower('A'))
it doesn't work.
I want to know that whether tolower or toupper can work with startswith?

shawzt
- 31
- 1
- 3
3
votes
4 answers
C# automatically apply ToLower to method string parameter?
Is there a way to make the C# compiler automatically apply ToLower() (or any other manipulating method invoke) to a particular method parameter before it gets used inside the method?
//additional information: its purpose is to use a Dictionary with…

Hendrik Wiese
- 2,010
- 3
- 22
- 49
3
votes
2 answers
How do I de-capitalize all file extensions given a directory?
originalFiles = Directory.GetFiles(fbFolderBrowser.SelectedPath).Where(file => !file.EndsWith(".db")).ToArray();
foreach (string file in originalFiles)
{
File.Move(file, file.Replace(".JPG", ".jpg"));
File.Move(file,…

JJ.
- 9,580
- 37
- 116
- 189
2
votes
2 answers
isalpha() function not working for spaces in string
I wrote a code so that it removes everything(like spaces and other things) other than the alphabats using isalpha() function and converts it to lower case using tolower() function. It is working fine if i don't put a space in the string but if there…

purple_tulip
- 37
- 1
- 7
2
votes
4 answers
Can't convert to Lower/uppercase a char* pointer using a loop in C without toupper
I am trying to make a function toLowerCase(char *string) but I am unable to make it work properly.
This is my code
void toLowerCase(char *string) {
int i = 0;
while (*(string+i) != '\0') {
if (*(string+i) >= 'A' && *(string+i) <=…

David Choi
- 145
- 1
- 10