capitalization

Capitalize first letters in words in the string with different separators using java 8 stream

爷,独闯天下 提交于 2021-02-08 09:54:41
问题 I need to capitalize first letter in every word in the string, BUT it's not so easy as it seems to be as the word is considered to be any sequence of letters, digits, "_" , "-", "`" while all other chars are considered to be separators, i.e. after them the next letter must be capitalized. Example what program should do: For input: "#he&llo wo!r^ld" Output should be: "#He&Llo Wo!R^Ld" There are questions that sound similar here, but there solutions really don't help. This one for example:

Format lowercased string to capitalize the begining of each sentence

﹥>﹥吖頭↗ 提交于 2020-05-29 03:04:59
问题 I have a string like FIRST SENTENCE. SECOND SENTENCE. I want to lowercase the string in that way to capitalize the first letter of each sentence. For example: string = string.toLowerCase().capitalize(); only the first sentence is capitalized. I have the String.prototype.capitalize = function() { return this.charAt(0).toUpperCase() + this.slice(1); } function Does anyone know how to solve? 回答1: If you only want to capitalize the first word of each sentence (not every word), then use this

Using replace and regex to capitalize first letter of each word of a string in JavaScript

◇◆丶佛笑我妖孽 提交于 2020-01-14 09:21:11
问题 The following,though redundant, works perfectly : 'leap of, faith'.replace(/([^ \t]+)/g,"$1"); and prints "leap of, faith", but in the following : 'leap of, faith'.replace(/([^ \t]+)/g,RegExp.$1); it prints "faith faith faith" As a result when I wish to capitalize each word's first character like: 'leap of, faith'.replace(/([^ \t]+)/g,RegExp.$1.capitalize()); it doesn't work. Neither does, 'leap of, faith'.replace(/([^ \t]+)/g,"$1".capitalize); because it probably capitalizes "$1" before

How to capitalize first letter razor

徘徊边缘 提交于 2020-01-14 07:39:06
问题 I am new to MVC and have not found a solution for this online. I have the html as : @Html.DisplayFor(model => model.Address1) <br /> I want all the first letter of address1 to be capital letters e.g. Something Road instead of something road. Now I have a class client and property Address1 and using EF to get the address as follow: public class MyDBContext : DbContext { public DbSet<Client> Clients { get; set; } } Hope it makes sense. 回答1: It's best to keep the presentation layer and the data

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

只谈情不闲聊 提交于 2020-01-11 19:59:24
问题 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. 回答1: You can use the regex: ^[A-Z0-9]{3}(?:List)?$ Explanation: ^ : Start anchor [A-Z0-9] : Char class to match any one of the uppercase letter or digit {3} : Quantifier for previous sub-regex (?:List) : A literal 'List' enclosed in non-capturing paranthesis ? : To

How to capitalize first letter of every single word in a text area?

浪子不回头ぞ 提交于 2020-01-07 08:49:15
问题 i have a multiline textfield("Adressfeld"), and i want to Uppercase every first letter and LowerCase the rest of every single word in this text area. Here is my try: function capitalize(Eingabe){ Eingabe = this.getField("Adressfeld").value; var strArr = Eingabe.split(" "); var newArr = []; for(var i = 0 ; i < strArr.length ; i++ ){ var FirstLetter = strArr[i].charAt(0).toUpperCase(); var restOfWord = strArr[i].slice(1).toLowerCAse(); newArr[i] = FirstLetter + restOfWord; } return newArr.join(

Captilize every word in ECHO string with PHP

微笑、不失礼 提交于 2020-01-06 15:21:00
问题 Aps if this seems really basic, I'm not a PHP developer. OK this shows you how to captalize each word in a string Capitalise every word of a string in PHP? BUT, how do you incorporate this into multiple strings being echoed? For example I have <?php echo $prefillTitle, ' ', $prefillFirstname, ' ', $prefillLastname; ?> How would I ensure each parameter echoes with it's first letter as a capital using the ucwords(). Would it be as simple as this? <?php echo ucwords($prefillTitle, ' ',

Capitalise first letter of words without changing currently Capitalised

。_饼干妹妹 提交于 2020-01-03 04:51:18
问题 Ive got some items of text in Excel and id like to capitalise the first letter of each word. However, a lot of text contains the phrase 'IT' and using current capitalisation methods (PROPER) it changes this to 'It'. Is there a way to only capitalise the first letter of each word without DE capitalising the other letters in each word? 回答1: Here is a VBA way, add it to a module & =PrefixCaps("A1") Public Function PrefixCaps(value As String) As String Dim Words() As String: Words = Split(value,

Capitalizing the first letter after a tag

◇◆丶佛笑我妖孽 提交于 2020-01-02 11:11:54
问题 I'm trying to come up with a search and replace method for capitalizing the first letter after a tag, but I've had no luck. I'm using the regex mode of Notepad++ . 回答1: In Notepad++, enable regex mode in the Find and Replace dialog box, then find: (?<=<p>)(.) and replace with: \U\1 To explain the pattern to be matched: (?<=a)b # A positive lookbehind, i.e. match all b that immediately follow a, but # don't match the "a" itself. (.) # Find any character (i.e. "."), and capture it. (?<=a)(.) #

Capitalize first letter of each word in the column Python

断了今生、忘了曾经 提交于 2019-12-30 03:46:14
问题 how do you capitalize the first letter of each word in the column? I am using python pandas by the way. For example, Column1 The apple the Pear Green tea My desire result will be: Column1 The Apple The Pear Green Tea 回答1: You can use str.title: print (df.Column1.str.title()) 0 The Apple 1 The Pear 2 Green Tea Name: Column1, dtype: object Another very similar method is str.capitalize, but it uppercases only first letters: print (df.Column1.str.capitalize()) 0 The apple 1 The pear 2 Green tea