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
2
votes
3 answers

How can I find all capitalization combinations of a String in Swift?

Problem I'm trying to find all of the possible combinations of capitalization for a String in Swift. For example, given the String "abc", I would want my method to return an Array of Strings, like this: ["Abc", "aBc", "abC", "ABc", "abc", "ABC",…
user20384561
2
votes
1 answer

How to alternate capitalizations with RegEX?

I need to change a sentence to have alternating capitalizations! Having trouble making it ignore the spacebar inputs... input: the quick brown fox jumps over the lazy dog output: tHe QuIcK bRoWn FoX jUmPs OvEr ThE lAzY dOg I tried the…
Baldur
  • 21
  • 1
2
votes
1 answer

How to create exceptions for toTitleCase()?

Say I have the following data frame: a <- c("Paul v. the man", "Molly v. the Bear") df <- data.frame(a) And I want to accomplish the following: I want to turn "Paul v. the man" to "Paul v. The Man," which I tried to use the…
hy9fesh
  • 589
  • 2
  • 15
2
votes
3 answers

Capitalization of all characters string in a double loop in Python

I have the following Python code, that cycles thru the string and capitalizes each character: str = 'abcd' l = list(str) for i in range(len(l)): rl = list(str) cap_char = l[i].capitalize() rl[i] = cap_char str1 = ''.join(rl) …
begemot
  • 23
  • 3
2
votes
2 answers

JQ Capitalize first letter of each word

I have a large JSON file that I am using JQ to pair down to only those elements I need. I have that working but there are some values that are string in all caps. Unfortunately, while jq has ascii_downcase and ascii_upcase, it does not have a built…
kittonian
  • 1,020
  • 10
  • 22
2
votes
1 answer

xlwings book open excel workbook but change the file name to lowercase

I used xlwings to open excel workbook. It worked fine up to last month. But today, when I run the same code, it opened my worksheet but convert my worksheet name into lowercase. Anybody know why is that? And how can I keep my original…
Daniel Yao
  • 21
  • 1
2
votes
4 answers

Capitalise every first letter of a string in an array of strings

I am basically taking a URL like http://localhost:3000/north-america/america and then after the third slash putting each entry into an array. I have an array of strings like this ["america", "north-america"]. I want to capitalise every first letter…
ashley g
  • 857
  • 3
  • 11
  • 21
2
votes
1 answer

Setting Sentence Capitalization on EditText Programmatically

Without using XML, how do I set EditText to capitalize sentences and still have predictive text working? I tried EditText.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES) and that works but it disables predictive text. How do I get predictive…
Brian
  • 7,955
  • 16
  • 66
  • 107
2
votes
3 answers

Function to return only the capital letter(s!) at the beginning of a string?

I'm trying to retrieve the first couple of capital letters from a string in PHP, but I'm not sure if there's a specific function to do this. Should I perhaps resort to using regex? If so, how? Here's an example of what should be returned (INPUT =>…
Chris
  • 2,905
  • 5
  • 29
  • 30
2
votes
2 answers

Finding honorific text and then capital letters in Python

file = open('AllCongress.txt', "r") lines = file.readlines() file.close() a = "" b = "" c = "" d = "" e = "" f = "" g = "" y = "" z = "" for x in lines: if ((x == "M") or (a == "M")): a == "M" if((x == "r") or (b == "r")): …
2
votes
3 answers

Split string on non consecutive capital letters

I'm trying to split a string by capital letter BUT i don't want to split two consecutive capital letters. So for now I'm doing this: my_string == "TTestStringAA" re.findall('[a-zA-Z][^A-Z]*', my_string) >>> ['T', 'Test', 'String', 'A', 'A'] But the…
2
votes
4 answers

How to find all words in a string that begin with an uppercase letter, for multiple strings in a list

I have a list of strings, each string is about 10 sentences. I am hoping to find all words from each string that begin with a capital letter. Preferably after the first word in the sentence. I am using re.findall to do this. When I manually set the…
2
votes
2 answers

Java - Is there a better substitute for WordUtils.capitalizeFully? Using Strings as delimiters

I'm trying to validate Strings containing names so that they are appropriately capitalised. I am using WordUtils.capitalizeFully(name.trim(), ' ', '-', '\''); Which is working fine for situations such as: johN o'SmITh => John O'Smith etc But is…
s.l
  • 131
  • 2
  • 6
2
votes
1 answer

How to capitalise the first letter of the month in a date formula?

I have the =Today() formula to be like this: 10 de julio de 2019 As you can see, the month julio (July) is in minus and I need the first letter upper/capitalized to be like: 10 de Julio de 2019 I know there is =UPPER(text) (for capitalizing all…
2
votes
6 answers

How to first letter capital in android , How to capitalise first letter in android?

I want forcefully add first letter capital in EditText. So i can search about i get lots of solution but i Notice that user can shift and enter lower characters. I tried below code : android:inputType="textCapSentences|textCapWords" Also I tried…
Joker
  • 796
  • 1
  • 8
  • 24