Questions tagged [capitalization]

Capitalization means changing each first letter of a string to a capital letter.

Capitalization means changing each first letter of all words in a string to capital letters. For example, "this is a test" would become "This Is A Test". In some programming languages, capitalization only makes the first letter of the string a capital, and not the first letter of each word.

412 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
469
votes
52 answers

How to capitalize the first character of each word in a string

Is there a function built into Java that capitalizes the first character of each word in a String, and does not affect the others? Examples: jon skeet -> Jon Skeet miles o'Brien -> Miles O'Brien (B remains capital, this rules out Title Case) old…
WillfulWizard
  • 5,340
  • 2
  • 19
  • 15
291
votes
9 answers

Correct Bash and shell script variable capitalization

I run across many shell scripts with variables in all caps, and I've always thought that there is a severe misunderstanding with that. My understanding is that, by convention (and perhaps by necessity long ago), environment variables are in…
JasonSmith
  • 72,674
  • 22
  • 123
  • 149
270
votes
8 answers

Is there a way to style a TextView to uppercase all of its letters?

I would like to be able to assign a xml attribute or style to a TextView that will make whatever text it has in ALL CAPITAL LETTERS. The attributes android:inputType="textCapCharacters" and android:capitalize="characters" do nothing and look like…
cottonBallPaws
  • 21,220
  • 37
  • 123
  • 171
226
votes
21 answers

Capitalize words in string

What is the best approach to capitalize words in a string?
vsync
  • 118,978
  • 58
  • 307
  • 400
166
votes
17 answers

Is there a good reason to use upper case for SQL keywords?

The default seems to be upper case, but is there really any reason to use upper case for keywords? I started using upper case, because I was just trying to match what SQL Server gives me whenever I tried to create something, like a new stored…
Hertanto Lie
  • 8,832
  • 7
  • 28
  • 27
116
votes
18 answers

Capitalize only first character of string and leave others alone? (Rails)

I'm trying to get Rails to capitalize the first character of a string, and leave all the others the way they are. I'm running into a problem where "i'm from New York" gets turned into "I'm from new york." What method would I use to select the first…
user316602
85
votes
8 answers

Is there a shorter replacement for Kotlin's deprecated String.capitalize() function?

Kotlin deprecated the capitalize function on String class, and their suggested replacement is obnoxiously long. This is an example of a situation where they made the right call on deprecating it, but the wrong call on the user experience. For…
Stevey
  • 2,822
  • 1
  • 23
  • 30
79
votes
21 answers

With jQuery, how do I capitalize the first letter of a text field while the user is still editing that field?

I'm looking for an example of how to capitalize the first letter of a string being entered into a text field. Normally, this is done on the entire field with a function, regex, OnBlur, OnChange, etc. I want to capitalize the first letter while the…
tresstylez
  • 1,809
  • 6
  • 29
  • 41
69
votes
4 answers

Capitalize first letter of sentences CSS

I want to capitalize the first letter of sentences, and also the first letter after commas if possible. I want to add the code in here: .qcont { width: 550px; height: auto; float: right; overflow: hidden; position: relative; }
1907
  • 825
  • 1
  • 7
  • 8
52
votes
4 answers

JavaScript createElementNS and SVG

I want to create inline SVG graphics using Javascript. However, it seems like createElementNS function applies some normalization and transforms all tags to lowercase. That is fine for HTML but not for XML/SVG. The NS I used is…
pat
  • 2,600
  • 4
  • 20
  • 21
47
votes
15 answers

UITableView titleForHeaderInSection shows all caps

I am using titleForHeaderInSection to show a header for a UITableView section. It worked fine with the iOS6 SDK, but the iOS7 SDK shows the header in all CAPS. I guess it's part of Apple's updated Human Interface Guidelines; all examples in there…
gbroekstg
  • 1,055
  • 1
  • 10
  • 19
45
votes
4 answers

Capitalize the first letter of every word in Scala

I know this way val str=org.apache.commons.lang.WordUtils.capitalizeFully("is There any other WAY")) Want to know is there any other way to do the Same. something in Scala Style
Govind Singh
  • 15,282
  • 14
  • 72
  • 106
43
votes
2 answers

Regex pattern for capital letters and numbers only, with possible 'List'

What is the regex to match words that have the pattern: Number or Capital in any order * 3 (+possible 'List' on the end) For example, OP3 G6H ZZAList 349 127List are all valid, whereas a3G P-0List HYiList def YHr are all invalid.
Iain Ward
  • 9,850
  • 5
  • 34
  • 41
42
votes
2 answers

How can I configure auto-capitalization behavior in Flutter's text entry fields?

I'm experimenting with Flutter development on Windows. I have a simple test app with an InputField. I would like the first keyboard entry to be a capital letter but can't see a way of achieving that (e.g. launching the keyboard with shift pressed)…
iBob101
  • 1,460
  • 3
  • 14
  • 20
1
2 3
27 28