Questions tagged [tolower]

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.

148 questions
0
votes
1 answer

Tolower function for array of strings in C

I have an array of strings and I'm trying to convert all characters to lower case. void make_lower(char **array) { int i = 0; while (array[i] != NULL){ array[i] = tolower(array[i]); i++; } } I know that tolower function reads…
caddy-caddy
  • 205
  • 1
  • 5
  • 11
0
votes
3 answers

Converting a C-String to all lower

I'm trying to convert a C-String to all lower case wihout the use of tolower from ctype.h . Hower my code does not seem to work: I'm receiving a runtime error. What I'm trying to do is changing the ASCII value of the capitalized letters bij 'a' -…
Actaeonis
  • 149
  • 1
  • 13
0
votes
3 answers

C++ Make Lower Function

I wrote a simple function in c++ to turn a string in to all lower case letters using chars and iterating through each char in the string. Can someone please explain why when I run this program in the console window, I get an output in addition to my…
Orren Ravid
  • 560
  • 1
  • 6
  • 24
0
votes
2 answers

any way to read in and make lower case in same step?

I'm reading in user input via string word; while(cin >> myWord) //put myWord in array but for the sake of sorting I want "This" and "this" to be the same. For my sort algorithm I'm using the default < and > values for string, so This != this,…
Tommy K
  • 1,759
  • 3
  • 28
  • 51
0
votes
3 answers

Improve std::sort performance

I have an index with about 10k items, which have to be sorted caseinsensitive lexicographically. This is my approach: bool lowercomp (AbstractServiceProvider::AbstractItem* i, AbstractServiceProvider::AbstractItem* j) { std::string a,b; …
ManuelSchneid3r
  • 15,850
  • 12
  • 65
  • 103
0
votes
2 answers

How does the behavior of std::tolower change in different locales?

I was reading the documentation for std::tolower at cppreference.com: Converts the given character to lowercase according to the character conversion rules defined by the currently installed C locale. In the default "C" locale, the following…
Michael Dorst
  • 8,210
  • 11
  • 44
  • 71
0
votes
1 answer

How can I lowercase an interpolated string inside Perl's qr//?

I'm using Perl Expect module for my SSH connections. I already have a module using sub functions like this: $exp->spawn("ssh -o ConnectTimeout=$connectTimeout $user\@$ip") or die ("unable to spawn \n"); @obj=$exp->expect( $commandTimeout, […
Gui O
  • 363
  • 4
  • 8
  • 22
0
votes
2 answers

How to manipulate a string to lower case and store in same variable

I have a piece of code that asks for user input, it is type "string" and its a really simple process, i want whatever the user inputs to be converted using the tolower() function. It does exactly as its supposed to do, but i can't seem to assign it…
Uys of Spades
  • 173
  • 1
  • 9
0
votes
3 answers

function tolower() not converting

What is wrong with this piece of code? I can't find out what's going on. #include #include int main(void) { char *s = "OKAY"; for (int i = 0; i < 4; i++) tolower(s[i]); printf("\n%s\n", s); return…
user3484582
  • 557
  • 1
  • 6
  • 22
0
votes
1 answer

run toLowerCase() against all keys in object

How can I use javascript String toLowerCase() method against all keys in an object? I'm comparing the keys in Object 2 (wordBank) to the keys in Object 1 (taskObject) to see if there is a match... I call: getAll(wordsObj["wordBank"]); Which…
user3871
  • 12,432
  • 33
  • 128
  • 268
0
votes
2 answers

Substring out of range when converting string to lowercase

I'm attempting to take an input from the command line and then convert it to lower case. To do this, I've written: istream& operator>>(istream& is, Card& c) { static map mr = createmr(); static map ms =…
The General
  • 1,239
  • 2
  • 17
  • 28
0
votes
1 answer

The use of tolower and storing in an array

I am trying to trace through this problem and can not figure out how the star is goes through the while loop and is stored in the array. Is * stored as 8 because of tolower? If anyone could please walk through the first for - to second for loop…
0
votes
1 answer

lower string characters and add a _ in front of converted capital letter

I have one more question, I want to add a _ in front of every Capital letter which will be converted to lowercase, plus the first letter cannot be capital!! I cant figure out how to do it... :{ example: input: loLollL, output: lo_loll_l and I want…
frank17
  • 107
  • 12
0
votes
4 answers

Capitalize the first letter, lower case the rest

I am asking a user to enter their name and I want to automatically format the name so that, no matter how they enter the name, it will appear as capital first letter, lower case the rest. For example, if they enter "joHN" the program will still…
user2999339
  • 11
  • 1
  • 1
  • 3
0
votes
2 answers

for_each implementation with tolower

I'm having trouble implementing the use of for_each, I can get the job done with a for loop, but for the sake of understanding, I could use some help with an explanation...I have the following function thus far... void clean_entry(const string&…
user1527185