Questions tagged [toupper]

In C / C++ toupper function converts a given character to uppercase according to the character conversion rules defined by the currently installed C locale. In the default "C" locale, the following lowercase letters abcdefghijklmnopqrstuvwxyz are replaced with respective uppercase letters ABCDEFGHIJKLMNOPQRSTUVWXYZ.

176 questions
-1
votes
2 answers

How to use toupper() on a pointer to a string?

I have tried the following: *string = toupper(*string); This only made the first char of the string pointer to by the pointer upper case. I want all the chars pointer to by *pointer to be in uppercase. Anyway I can do this?
John
  • 105
  • 1
  • 8
-1
votes
1 answer

Simple program unable to get toupper working

Im practicing with the toupper function but i can make this work, always crash at the point of the printf so i think arguments are bad, or so. #include #include #include #include int main (void){ char…
-2
votes
1 answer

How to use toUpper and toLower in Haskell without importing module Data.Char?

So I am trying to write my own functions without help from imports and i am struggling to have a function that works the same way. Here is what I have. toLower'' :: [Char]-> [Char] toLower'' [] = [] toLower'' (x : xs) | x `elem` ['a' .. 'z'] =…
-2
votes
2 answers

How do you do a "ToUpper" on all char in a list in a single line in C#?

I was tasked with this assignement but I cannot figure out how to do it. I have a list of characters and I have to return a new list with the same contents except all the characters that are lowercase are changed to uppercases.
-2
votes
3 answers

How can I use the toupper or tolower function on a string array

I was wondering how to use the toupper function so when the user can type in these words any way they want. //fill in arrays word[0] = "VERY"; word[1] = "MERRY"; word[2] = "CHRISTMAS"; word[3] = "EVERYONE"; for…
user12743659
-2
votes
1 answer

How can I capitalize the first letter of each sentence in C# using char?

Sentence capitalization: private string SentenceCapitalizer(string input) { char delim = '.'; string letter1; string[] tokens = input.Split(delim); foreach (string phrase in tokens) { letter1 = phrase.Remove(0); letter1.ToUpper(); } …
-2
votes
2 answers

C first letter to uppercase ignores first word

I am trying to make every first word letter capital, but it ignores the first word and jumps to second. "apple macbook" should be "Apple Macbook", but it gives me "apple Macbook". If I add printf(" %c", toupper(string[0])); before for loop and…
ChrisMe
  • 55
  • 5
-2
votes
5 answers

Capitalize every word in a string array

So I want to create a code that capitalizes the first letter of every word in a string array, then outputs the string in reverse order. I couldn't print the array in reverse, but with that aside, this is what I came up with: #include…
Rog
  • 13
  • 1
-2
votes
1 answer

Capitalizing first letter in each word

Output is same as the input where am i making the mistake? Pls check the test version, it prints the ASCII code of 'A' but not A why is it so? The 1st if condition in the loop is to make sure that the string starts with a valid character only…
Stack
  • 235
  • 3
  • 15
-3
votes
3 answers

I have a program that capitalizes all words of a string. The program is working but I want to understand what the code is doing

#include char *cap_string(char *str); int main(void) { char str[] = "Expect the best. Prepare for the worst. Capitalize on what comes.\nhello world! hello-world 0123456hello world\thello world.hello world\n"; char *ptr; ptr =…
-3
votes
2 answers

How to change names to some friendly names in python?

I have few dummy function names and I want to transform them as follows: sample case 1 input : getDataType output: Data_Type sample case 2 input: getDatasetID output: Dataset_ID My code is as below: def apiNames(funcName): name =…
-3
votes
1 answer

Implement a program that, given a person’s name, prints a person’s initials

can please someone help me finding the error in my code. their are no syntax error. but somewhere it is wrong since i am not getting my desired output. the functions gets() and toupper() are not getting implemented from the library. #include…
-3
votes
1 answer

toupper and tolower with pointers

I am trying to figure out how to use toupper and tolower using pointers. I thought I was on the right track. I managed to get the pointers correct for the uppercase letters but for some reason, it won't work for the lowercase. Any advice would be…
Drew
  • 23
  • 1
-3
votes
1 answer

I have tried to make code for inbuild javascript function (touppercase).Does this helpfull or not?

This code is basically use as a inbuilt fuction of javascript touppercase shortformat which would be benificial for interview .sometimes we need not to use inbuilt functions ..so there is code for them. //change lower case to upper case …
jatin
  • 1
-3
votes
2 answers

Simple toupper coding in C

I want to make a simple toupper coding on my Laptop (windows 7). It appears that anything i wrote it only capitalize 1 word in the beginning. Whether i use %s / %c / %[^\n] What am I suppoused to do? Im using Microsoft Visual C++ 2010…
1 2 3
11
12