|
Hi all,
I'm abit of a newbie to C so what i am askign may be simple but i can't seem to find much on the internet.
i have:
char name[15];
Which could for example, contain the name "james". What can i use to check if the first character (in this case "j") is lowercase and if it is, change it to uppercase.
Many Thanks!
|
|
|
|
|
Sorry just found it myself, literally just after i posted this.
name[0] = toupper(name[0]);
|
|
|
|
|
In c language you can check wether the language is in lower case or upper case by using their ASCII value.
ie, for "A" ASCII value is 65. for "a" ASCII is 97. by directly checking this condition you can ensure character is small letter or capital letter.
to convert you can use
toupper or
tolower .
|
|
|
|
|
What happens if the letter is "b" or ... The standard way of checking is to use isupper() [^].
One of these days I'm going to think of a really clever signature.
|
|
|
|