capitalization

Javascript: Capitalization of each Word in String

末鹿安然 提交于 2019-12-10 18:05:22
问题 Greetings, I want to capitalize each word in a script, for this I have came up with a such method: //Word Capitalization function wordToUpper(val) { newVal = ''; val = val.toLowerCase().split(' '); for(var c=0; c < val.length; c++) { newVal += val[c].substring(0,1).toUpperCase() + val[c].substring(1,val[c].length) + ' '; } return newVal; } Now it works for regular words starting after and emtpy char " ". However I also want to make sure it fails for such strings: wordToUpper('hello my name is

How can I capitalize a string showed by Thymeleaf into a page?

非 Y 不嫁゛ 提交于 2019-12-10 13:06:19
问题 I am working on a Spring MVC application that uses Thymeleaf as template engine and I am trying to capitalize some string showed into my page. On my page I have something like this: <li class="com__nav-item" th:each="menuItem : ${#authentication.principal.listaFunzioniUtente}"> <a href="" class="com__nav-link centered"> <span class="blue-line animate scaleIn delay-3" style="font-size: 1.4em; text-align: center;" th:text="${#strings.capitalize(menuItem.desFnz)}"></span> <span class="white

PHP to capitalize all letters (including after a slash) except for certain words

心不动则不痛 提交于 2019-12-10 10:37:21
问题 I want to use PHP to clean up some titles by capitalizing each word, including those following a slash. However, I do not want to capitalize the words 'and', 'of', and 'the'. Here are two example strings: accounting technology/technician and bookkeeping orthopedic surgery of the spine Should correct to: Accounting Technology/Technician and Bookkeeping Orthopedic Surgery of the Spine Here's what I currently have. I'm not sure how to combine the implosion with the preg_replace_callback. // Will

Capitalizing texts in user interface

旧巷老猫 提交于 2019-12-09 12:44:47
问题 I'd like to ask you if there is a reason to capitalize all items in menus, etc in application user interface, for example File->Page Setup Edit->Select All Help->Technical Support Why shouldn't I just label these items as File->Page setup etc.? This kind of capitalization just seems wrong to me - but I am not a native English speaker, so I just might not dig it. //(Pressed Post Your Question button to make this appear) 回答1: In English, generally titles have all words capitalised except for

Capitalize f.text_field

时光毁灭记忆、已成空白 提交于 2019-12-07 01:40:44
问题 I have a form_for and I want that any value inside x.textField appear with the first letter in Upcase (I'm talking about the edit where the textfield are prefilled by the db values). 回答1: You can capitalize it like this: <%= form_for ... do |f| %> <%= f.text_field :name, :value => f.object.name.capitalize %> 回答2: You can do this with CSS... = f.text_field :some_attribute, style: 'text-transform: capitalize;' 回答3: Pan Thomakos's solution will work, but if you don't want to have to add :value =

Capitalizing the first letter after a tag

回眸只為那壹抹淺笑 提交于 2019-12-06 06:08:06
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++ . 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)(.) # Find any character that immediately follows a, and capture it. And the replacement: \1 # The first captured

PHP to capitalize all letters (including after a slash) except for certain words

北战南征 提交于 2019-12-05 19:25:33
I want to use PHP to clean up some titles by capitalizing each word, including those following a slash. However, I do not want to capitalize the words 'and', 'of', and 'the'. Here are two example strings: accounting technology/technician and bookkeeping orthopedic surgery of the spine Should correct to: Accounting Technology/Technician and Bookkeeping Orthopedic Surgery of the Spine Here's what I currently have. I'm not sure how to combine the implosion with the preg_replace_callback. // Will capitalize all words, including those following a slash $major = implode('/', array_map('ucwords'

How would I make Apache case insensitive using .htaccess?

て烟熏妆下的殇ゞ 提交于 2019-12-05 11:13:15
问题 I recently switched from IIS to Apache and unfortionately some of my links have capitalization issues. I have seen quite a few people talking about how to rewrite urls to be all lowercase or all uppercase but I need something to just make Apache case insensitive. Is this doable with .htaccess? 回答1: add CheckSpelling on to your .htaccess file of course after enabling the RewriteEngine so the final code will be RewriteEngine on CheckSpelling on I guess it is the best and safest way. dont forget

How to capitalize first letter of each line in bash? [duplicate]

和自甴很熟 提交于 2019-12-05 08:14:50
问题 This question already has answers here : Changing the first letter of every line in a file to uppercase (6 answers) Closed 2 years ago . I'm looking for a command that capitalizes the first letter of each line in bash. Actually I used this command: sed 's/^\(.\)/\U\1/' But I need to use another command instead of "\U". . 回答1: Why do you need to use something else than \U ? You can use \u which only capitalizes one letter: sed 's/./\u&/' Or, use parameter expansion: while read line ; do echo "

Capitalize f.text_field

限于喜欢 提交于 2019-12-05 05:07:24
I have a form_for and I want that any value inside x.textField appear with the first letter in Upcase (I'm talking about the edit where the textfield are prefilled by the db values). You can capitalize it like this: <%= form_for ... do |f| %> <%= f.text_field :name, :value => f.object.name.capitalize %> You can do this with CSS... = f.text_field :some_attribute, style: 'text-transform: capitalize;' Pan Thomakos's solution will work, but if you don't want to have to add :value => f.object.name.capitalize to every text field on the form, you could look into writing your own FormBuilder. Put this