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 .

321 questions
813
votes
24 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
  • 259,804
  • 351
  • 777
  • 1,080
488
votes
59 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
  • 4,889
  • 2
  • 15
  • 3
236
votes
45 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
  • 12,594
  • 12
  • 41
  • 63
220
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
  • 7,191
  • 5
  • 22
  • 19
144
votes
24 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,947
  • 9
  • 36
  • 69
142
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,752
  • 11
  • 40
  • 52
139
votes
14 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
  • 12,582
  • 38
  • 102
  • 152
110
votes
9 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,814
  • 7
  • 40
  • 79
85
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
  • 13,627
  • 17
  • 49
  • 62
62
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
  • 793
  • 1
  • 6
  • 9
56
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,659
  • 7
  • 27
  • 35
52
votes
3 answers

Capitalize first letter of a string using Angular or typescript

How can I capitalize the first letter of a string using Angular or typescript?
user2004
  • 1,783
  • 4
  • 15
  • 42
42
votes
9 answers

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

I use this to capitalize every first letter every word: #(\s|^)([a-z0-9-_]+)#i 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
  • 421
  • 1
  • 4
  • 5
37
votes
11 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
  • 121,420
  • 116
  • 450
  • 651
34
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
  • 529
  • 2
  • 6
  • 7
1
2 3
21 22