Questions tagged [capitalize]

Capitalize is writing a word with its first letter as a capital letter (upper-case letter) and the remaining letters in lower case.

Capitalize is writing a word with its first letter as a capital letter (upper-case letter) and the remaining letters in lower case.

Mark the questions with this tag if it concerns automatic capitalization of strings.

If question is related to make the whole string upper-case, use tag .

279 questions
4160
votes
104 answers

How do I make the first letter of a string uppercase in JavaScript?

How do I make the first letter of a string uppercase, but not change the case of any of the other letters? For example: "this is a test" → "This is a test" "the Eiffel Tower" → "The Eiffel Tower" "/index.html" → "/index.html"
Robert Wills
  • 42,187
  • 3
  • 15
  • 6
679
votes
20 answers

How can I capitalize the first letter of each word in a string?

s = 'the brown fox' ...do something here... s should be: 'The Brown Fox' What's the easiest way to do this?
TIMEX
  • 217,272
  • 324
  • 727
  • 1,038
381
votes
56 answers

How to capitalize the first letter of a String in Java?

I am using Java to get a String input from the user. I am trying to make the first letter of this input capitalized. I tried this: String name; BufferedReader br = new InputStreamReader(System.in); String s1 =…
sumithra
  • 3,819
  • 2
  • 13
  • 3
197
votes
10 answers

python capitalize first letter only

I am aware .capitalize() capitalizes the first letter of a string but what if the first character is a integer? this 1bob 5sandy to this 1Bob 5Sandy
user1442957
  • 5,495
  • 5
  • 19
  • 18
141
votes
17 answers

How do I capitalize first letter of first name and last name in C#?

Is there an easy way to capitalize the first letter of a string and lower the rest of it? Is there a built in method or do I need to make my own?
Mike Roosa
  • 4,541
  • 10
  • 36
  • 51
137
votes
23 answers

Capitalize the first letter of string in AngularJs

I want capitalize first character of string in angularjs As i used {{ uppercase_expression | uppercase}} it convert whole string to upper case.
Piyush
  • 3,697
  • 7
  • 31
  • 63
122
votes
13 answers

Capitalize first letter. MySQL

Does any one know the equivalent to this TSQL in MySQL parlance? I am trying to capitalize the first letter of each entry. UPDATE tb_Company SET CompanyIndustry = UPPER(LEFT(CompanyIndustry, 1)) + SUBSTRING(CompanyIndustry, 2, LEN(CompanyIndustry))
Chin
  • 11,899
  • 35
  • 98
  • 151
103
votes
28 answers

How to capitalize the first letter of a string in dart?

How do I capitalize the first character of a string, while not changing the case of any of the other letters? For example, "this is a string" should give "This is a string".
Kasper
  • 8,678
  • 10
  • 34
  • 53
91
votes
8 answers

Capitalize first letter of each word in a selection using Vim

In Vim, I know we can use ~ to capitalize a single char (as mentioned in this question), but is there a way to capitalize the first letter of each word in a selection using Vim? For example, if I would like to change this hello world from stack…
keelar
  • 5,334
  • 6
  • 35
  • 73
70
votes
5 answers

Regular expression for checking if capital letters are found consecutively in a string?

I want to know the regexp for the following case: The string should contain only alphabetic letters. It must start with a capital letter followed by small letter. Then it can be small letters or capital letters. ^[A-Z][a-z][A-Za-z]*$ But the string…
kiki
  • 12,017
  • 16
  • 46
  • 62
58
votes
8 answers

Check if first letter of word is a capital letter

Is it possible in JavaScript to find out if the first letter of a word is a capital letter?
James J
  • 753
  • 1
  • 6
  • 9
55
votes
15 answers

How to autocapitalize the first character in an input field in AngularJS?

How to autocapitalize the first character in an input field inside an AngularJS form element? I saw the jQuery solution already, but believe this has to be done differently in AngularJS by using a directive.
Federico Elles
  • 4,439
  • 7
  • 25
  • 34
36
votes
10 answers

Ruby on Rails uncapitalize first letter

I'm running Rails 2.3.2. How do I convert "Cool" to "cool"? I know "Cool".downcase works, but is there a Ruby/Rails method that does the opposite of capitalize, i.e., uncapitalize or decapitalize?
ma11hew28
  • 106,283
  • 107
  • 420
  • 616
34
votes
8 answers

Regex capitalize first letter every word, also after a special character like a dash

I use this #(\s|^)([a-z0-9-_]+)#i for capitalize every first letter every word, i want it also to capitalize the letter if it's after a special mark like a dash(-) Now it shows: This Is A Test For-stackoverflow And i want this: This Is A Test…
Simmer
  • 341
  • 1
  • 3
  • 5
30
votes
10 answers

How can I capitalize the first letter of each word in a string in Perl?

What is the easiest way to capitalize the first letter in each word of a string?
Dan Littlejohn
  • 489
  • 2
  • 6
  • 7
1
2 3
18 19