Questions tagged [title-case]

In string or sentence formatting, title case is the term used for capitalizing the first character of each principal word.

In string or sentence formatting, title case is the term used for capitalizing the first character of each principal word.

95 questions
769
votes
69 answers

Convert string to Title Case with JavaScript

Is there a simple way to convert a string to Title Case? E.g. john smith becomes John Smith. I'm not looking for something complicated like John Resig's solution, just (hopefully) some kind of one- or two-liner.
MDCore
  • 17,583
  • 8
  • 43
  • 48
233
votes
47 answers

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

I'm trying to write a function that capitalizes the first letter of every word in a string (converting the string to title case). For instance, when the input is "I'm a little tea pot", I expect "I'm A Little Tea Pot" to be the output. However, the…
slurrr
  • 2,534
  • 2
  • 11
  • 10
199
votes
15 answers

Capitalize the first letter of both words in a two word string

Let's say that I have a two word string and I want to capitalize both of them. name <- c("zip code", "state", "final count") The Hmisc package has a function capitalize which capitalized the first word, but I'm not sure how to get the second word…
ATMathew
  • 12,566
  • 26
  • 69
  • 76
129
votes
25 answers

SQL Server: Make all UPPER case to Proper Case/Title Case

I have a table that was imported as all UPPER CASE and I would like to turn it into Proper Case. What script have any of you used to complete this?
RyanKeeter
  • 5,939
  • 7
  • 32
  • 40
126
votes
22 answers

Is there a method for String conversion to Title Case?

Are there any built in methods available to convert a string into Title Case format?
Raji
104
votes
19 answers

Convert String To camelCase from TitleCase C#

I have a string that I converted to a TextInfo.ToTitleCase and removed the underscores and joined the string together. Now I need to change the first and only the first character in the string to lower case and for some reason, I can not figure out…
Gabriel_W
  • 1,645
  • 5
  • 16
  • 26
95
votes
9 answers

Titlecasing a string with exceptions

Is there a standard way in Python to titlecase a string (i.e. words start with uppercase characters, all remaining cased characters have lowercase) but leaving articles like and, in, and of lowercased?
yassin
  • 6,529
  • 7
  • 34
  • 39
94
votes
11 answers

RegEx to split camelCase or TitleCase (advanced)

I found a brilliant RegEx to extract the part of a camelCase or TitleCase expression. (? value camelValue -> camel / Value TitleValue -> Title / Value For example with Java: String s =…
Jmini
  • 9,189
  • 2
  • 55
  • 77
56
votes
5 answers

Make first letter of words uppercase in a string

I have a large array of strings such as this one: "INTEGRATED ENGINEERING 5 Year (BSC with a Year in Industry)" I want to capitalise the first letter of the words and make the rest of the words lowercase. So INTEGRATED would become Integrated. A…
Conor
  • 721
  • 1
  • 6
  • 18
47
votes
12 answers

Title case a string containing one or more last names while handling names with apostrophes

I want to standardize a user-supplied string. I'd like the first letter to be capitalized for the name and if they have entered two last names, then capitalize the first and second names. For example, if someone enters: marriedname maidenname It…
user1048676
  • 9,756
  • 26
  • 83
  • 120
43
votes
12 answers

Is there a simple way to convert MySQL data into Title Case?

I have a MySQL table where all the data in one column was entered in UPPERCASE, but I need to convert in to Title Case, with recognition of "small words" akin to the Daring Fireball Title Case script. I found this excellent solution for transforming…
John Stephens
  • 781
  • 2
  • 12
  • 19
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
30
votes
20 answers

Format string to title case

How do I format a string to title case?
tags2k
  • 82,117
  • 31
  • 79
  • 106
30
votes
3 answers

Difference between uppercase and titlecase

What's the difference between uppercase and titlecase. Frankly, I never heard of titlecase before. In java there are seperate methods for both: Character.isTitleCase(char) Character.isUpperCase(char) Some websites define it as follows: TitleCase:…
bvdb
  • 22,839
  • 10
  • 110
  • 123
27
votes
4 answers

Capitalize the first letter of each word in a filename with powershell

I want to change the names of some files automatically. With this code I change the lowercase letters to uppercase: get-childitem *.mp3 | foreach { if ($.Name -cne $.Name.ToUpper()) { ren $.FullName $.Name.ToUpper() } } But I only want the first…
Gilko
  • 2,280
  • 8
  • 36
  • 45
1
2 3 4 5 6 7