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
8
votes
6 answers

if/else statements accepting strings in both capital and lower-case letters in python

Is there a quick way for an "if" statement to accept a string regardless of whether it's lower-case, upper-case or both in python? I'm attempting to write a piece of code where the number "3" can be entered as well as the word "three"or "Three" or…
SkyBlade16395
  • 117
  • 1
  • 1
  • 12
8
votes
7 answers

How can I capitalize all the strings inside an array directly?

I'm learning swift. I've been trying this in Playground. I have no idea why the string is not being capitalized here. Or is there any other way to capitalize the string inside the array directly? Here's my code. var dogNames = ["Sean", "fido",…
Rhenz
  • 2,293
  • 1
  • 14
  • 14
8
votes
4 answers

Capitalize / Capitalise first letter of every word in a string in Matlab?

What's the best way to capitalize / capitalise the first letter of every word in a string in Matlab? i.e. the rain in spain falls mainly on the plane to The Rain In Spain Falls Mainly On The Plane
Anthony
  • 1,306
  • 4
  • 13
  • 23
7
votes
3 answers

How to capitalize each word even after hyphens with Jquery?

I want to capitalize all words in an input (using keyup function) to format names entered. examples : john doe => John Doe JOHN DOE => John Doe tommy-lee => Tommy-Lee Currently, I use this code : $("input").keyup(function() { var cp_value=…
user1010687
  • 73
  • 1
  • 4
7
votes
2 answers

Smarty "capitalize" modifier... always capitalizes "L"? ... and "P"?

Quite simply: I'm using Smarty and the |capitalize modifier. It works fine, but when I pass any word with l in it, it capitalizes it, even if it's not at the beginning of the word. What why? EDIT: Same happens with…
Lazlo
  • 8,518
  • 14
  • 77
  • 116
7
votes
4 answers

How to capitalize string in fish shell?

I got the following text: Lorem ipsum dolor sit amet, consectetur adipisicing elit. That I want to capitalize, i.e. uppercase first letter of every word. Expected result Lorem Ipsum Dolor Sit Amet, Consectetur Adipisicing Elit. Bash…
Édouard Lopez
  • 40,270
  • 28
  • 126
  • 178
7
votes
1 answer

QML TextField how to capitalize the text

In QML how can I have a text input box that automatically converts the inputted text to all capitals? The following doesn't work: TextField { id: myfield objectName: "myfield" ... font.pixelSize: 20 …
glennr
  • 2,069
  • 2
  • 26
  • 37
6
votes
6 answers

JavaScript Code to Capitalize Text Inputs

I'm using the popular Firefox extension Greasemonkey. I'd like to know if there was a way to capitalize all text inputs in a certain form, so if I would use jQuery the code would look something like: $('form#formid…
henryaaron
  • 6,042
  • 20
  • 61
  • 80
6
votes
4 answers

Capitalizing hyphenated name

I have a script looking like this: firstn = input('Please enter your first name: ') lastn = input('Please enter Your last name: ') print('Good day, ' + str.capitalize(firstn) + ' ' + str.capitalize(lastn)+ '!') It will work nicely with simple…
O.Kokla
  • 63
  • 1
  • 4
6
votes
7 answers

How to capitalize letter only in beginning of sentences, and the next word is normal

I use this: Static PreviousLetter As Char If PreviousLetter = " "c Or TextBox1.Text.Length = 0 Then e.KeyChar = Char.ToUpper(e.KeyChar) End If PreviousLetter = e.KeyChar But the result is always: Good Night Every Body How can I…
walk.this_way
  • 169
  • 1
  • 2
  • 11
6
votes
5 answers

Function that takes a nested list of strings and returns a new nested list with all strings capitalized?

This will capitalize them but only if there are no nested lists. t = ['this','that', ['other']] def capitalize_nested(t): res = [] for s in t: res.append(s.capitalize()) return res print capitalize_nested(t) I can't figure out…
user1927093
5
votes
3 answers

Is there a JS equivalent to CSS text-transform: capitalize?

I've got a hidden
that is comprised of divs that contain content to be stuffed into a jQuery UI dialog. On document.ready I want to loop through those divs, take the id of each respective div, replace dashes with spaces, capitalize each…
Code Maverick
  • 20,171
  • 12
  • 62
  • 114
5
votes
3 answers

need capitalize words with special chars in PHP

ucwords doesn't capitalize foreign chars like öüäõ so I need a solution, which will make "öösel" into "Öösel" Is there a simple way to do it with regexp or I have to check all the characters manually?
Hannes
  • 55
  • 1
  • 3
5
votes
3 answers

Convert string to title case after dash or slash

I use this common function to convert most of my list items to title case with no issues. I've discovered one place that needs improvement, when there is a dash or slash in the middle, I want the next letter capitalized. For example Hispanic/latino…
Connie DeCinko
  • 996
  • 5
  • 19
  • 39
5
votes
6 answers

PHP - Capitalise first character of each word expect certain words

I have a batch of strings like so: tHe iPad hAS gONE ouT of STOCK PoWER uP YOur iPhone wHAT moDEL is YOUR aPPLE iPHOne I want to capitalise the first character of each word and have the remaining characters lowercase - except any references of…
odd_duck
  • 3,941
  • 7
  • 43
  • 85
1 2
3
21 22