capitalization

How do I capitalize the first letter of a word in Vim?

我只是一个虾纸丫 提交于 2019-11-30 08:19:05
For a long time I've known that I can use ~ in Vim to toggle the case of a character. But is there a way to map a key to capitalize a word and go back to the previous position? For example: I like to drink Coca co[l] If my cursor is at "l" and I realize I need to make the "c" capitalize as well, currently, I need to do: <C-c> b ~ ll i Is there a way to map a single key to make the first letter of the word under cursor to be capitalized and keep the cursor at original position? :nmap <whatever> m`b~`` Personally, this is exactly the kind of thing I prefer not to make a macro for. There's no

how can i check if a letter in a string is capitalized using python?

谁说胖子不能爱 提交于 2019-11-30 07:46:43
问题 I have a string like "asdfHRbySFss" and I want to go through it one character at a time and see which letters are capitalized. How can I do this in Python? 回答1: Use string.isupper() letters = "asdfHRbySFss" uppers = [l for l in letters if l.isupper()] if you want to bring that back into a string you can do: print "".join(uppers) 回答2: Another, more compact, way to do sdolan's solution in Python 2.7+ >>> test = "asdfGhjkl" >>> print "upper" if any(map(str.isupper, test)) else "lower" upper >>>

strtoupper PHP function for UTF-8 string

南楼画角 提交于 2019-11-30 07:46:39
问题 I've been reading user comments for the strtoupper() PHP function and there doesn't seem to a consensus on how to do the conversion for non-Enlgish strings. I mean people offer localized solutions and stuff, but shouldn't there be a uniform way to convert a string to all upper (or all lower) case letters? So my question is, say, if I have a UTF-8 encoded string (in some unknown locale) how do I convert it to all upper/lower letters in PHP? 回答1: You want to use mb_strtoupper . $str = "Τάχιστη

Trying to capitalize the first character in array of strings, why this is not working?

浪子不回头ぞ 提交于 2019-11-29 18:29:41
问题 I'm a beginner at Javascript. I'm trying to write a function that converts for example list-style-image to listStyleImage . I came up with a function but it seems not working. Can anybody point me to the problem here ? var myStr = "list-style-image"; function camelize(str){ var newStr = ""; var newArr = []; if(str.indexOf("-") != -1){ newArr = str.split("-"); for(var i = 1 ; i < newArr.length ; i++){ newArr[i].charAt(0).toUpperCase(); } newStr = newArr.join(""); } return newStr; } console.log

Did capitals ever matter in email addresses? [closed]

妖精的绣舞 提交于 2019-11-29 16:24:33
问题 My dad says capitals used to matter (years ago) for email addresses but don't anymore. I'm fairly sure they never did because something like that involving DNS/MX changes would not change. Especially with no easy to find record online. 回答1: Let's look at this in pieces: The domain part of the email address needs to conform to RFC 1034 and is thus (and has always been) case insensitive: http://www.ietf.org/rfc/rfc1034.txt The local part of the email address is handled by the receiving mail

Permutations of capitalization

本秂侑毒 提交于 2019-11-29 15:44:58
I want to build a list containing every possible permutation of capitalization of a word. so it would be List<string> permutate(string word) { List<string> ret = new List<string>(); MAGIC HAPPENS HERE return ret; } So say I put in "happy" I should get an array back of {happy, Happy, hAppy, HAppy, haPpy, HaPpy ... haPPY, HaPPY, hAPPY, HAPPY} I know of plenty of functions that will capitalize the first letter but how do I do any arbitrary letter in the word? You can modify individual characters if you convert your string to an array of char. Something like this should do the trick... public

Capitalization of Person names in programming [closed]

我是研究僧i 提交于 2019-11-29 09:13:21
Is anyone aware of some code/rules on how to capitalize the names of people correctly? John Smith Johan van Rensburg Derrick von Gogh Ruby de La Fuente Peter Maclaurin Garry McDonald (these may not be correct, just some sample names and how the capitalization could be/work) This seems like a losing battle... If anyone has some code or rules on when and how to capitalize names, let me know :) Cheers, Albert The only sensible way to handle it, in my opinion, is to let the users tell you how their name should be capitalized. Any automatic scheme is going to annoy someone. Just tell them you're

Capitalization convention for JavaScript objects

落爺英雄遲暮 提交于 2019-11-29 05:37:39
问题 I know this question has no answer, but I'm curious to know what other people think. In a language like Java, it's a convention to begin classes with capital letters, and objects with lowercase letters. But what about JavaScript, where everything is an object? I've seen some people suggest capitalizing only objects that are treated as classes; i.e. function objects with a prototype, that are intended to be used with the new operator. Instances of those objects would be lowercased. That sounds

strtoupper PHP function for UTF-8 string

一世执手 提交于 2019-11-29 05:27:11
I've been reading user comments for the strtoupper() PHP function and there doesn't seem to a consensus on how to do the conversion for non-Enlgish strings. I mean people offer localized solutions and stuff, but shouldn't there be a uniform way to convert a string to all upper (or all lower) case letters? So my question is, say, if I have a UTF-8 encoded string (in some unknown locale) how do I convert it to all upper/lower letters in PHP? You want to use mb_strtoupper . $str = "Τάχιστη αλώπηξ βαφής ψημένη γη, δρασκελίζει υπέρ νωθρού κυνός"; $str = mb_strtoupper($str, "UTF-8"); echo $str; //

Capitalizing words in a string using c#

放肆的年华 提交于 2019-11-29 03:05:30
I need to take a string, and capitalize words in it. Certain words ("in", "at", etc.), are not capitalized and are changed to lower case if encountered. The first word should always be capitalized. Last names like "McFly" are not in the current scope so the same rule will apply to them - only first letter capitalized. For example: "of mice and men By CNN" should be changed to "Of Mice and Men by CNN". ( Therefore ToTitleString won't work here ) I'm wondering what would be the best way to do that. What I thought of is to split the string by spaces, and go over each word, changing it if