Capitalize first letter of sentences CSS

You can capitalize the first letter of the .qcont element by using the pseudo-element :first-letter. .qcont:first-letter{ text-transform: capitalize } This is the closest you’re gonna get using only css. You could use javascript (in combination with jQuery) to wrap each letter which comes after a period (or comma, like you wish) in a span. You … Read more

How to capitalize the first letter of every sentence?

You could use nltk for sentence segmentation: #!/usr/bin/env python3 import textwrap from pprint import pprint import nltk.data # $ pip install http://www.nltk.org/nltk3-alpha/nltk-3.0a3.tar.gz # python -c “import nltk; nltk.download(‘punkt’)” sent_tokenizer = nltk.data.load(‘tokenizers/punkt/english.pickle’) text = input(‘Enter a sentence/sentences please:’) print(“\n” + textwrap.fill(text)) sentences = sent_tokenizer.tokenize(text) sentences = [sent.capitalize() for sent in sentences] pprint(sentences) Output Enter a sentence/sentences … Read more

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

You have to actually re-assign the array element: for(var i = 1 ; i < newArr.length ; i++){ newArr[i] = newArr[i].charAt(0).toUpperCase(); } The “toUpperCase()” function returns the new string but does not modify the original. You might want to check to make sure that newArr[i] is the empty string first, in case you get an … Read more

Capitalize first letter of each word, in existing table

There’s no MySQL function to do that, you have to write your own. In the following link there’s an implementation: http://joezack.com/index.php/2008/10/20/mysql-capitalize-function/ In order to use it, first you need to create the function in the database. You can do this, for example, using MySQL Query Browser (right-click the database name and select Create new Function). … Read more

JavaScript createElementNS and SVG

I hope, the following example will help you: function CreateSVG() { var xmlns = “http://www.w3.org/2000/svg”; var boxWidth = 300; var boxHeight = 300; var svgElem = document.createElementNS(xmlns, “svg”); svgElem.setAttributeNS(null, “viewBox”, “0 0 ” + boxWidth + ” ” + boxHeight); svgElem.setAttributeNS(null, “width”, boxWidth); svgElem.setAttributeNS(null, “height”, boxHeight); svgElem.style.display = “block”; var g = document.createElementNS(xmlns, “g”); svgElem.appendChild(g); … Read more

Capitalize words in string [duplicate]

/** * Capitalizes first letters of words in string. * @param {string} str String to be modified * @param {boolean=false} lower Whether all other letters should be lowercased * @return {string} * @usage * capitalize(‘fix this string’); // -> ‘Fix This String’ * capitalize(‘javaSCrIPT’); // -> ‘JavaSCrIPT’ * capitalize(‘javaSCrIPT’, true); // -> ‘Javascript’ */ const … Read more

How can I capitalize the first letter of each word in a string?

The .title() method of a string (either ASCII or Unicode is fine) does this: >>> “hello world”.title() ‘Hello World’ >>> u”hello world”.title() u’Hello World’ However, look out for strings with embedded apostrophes, as noted in the docs. The algorithm uses a simple language-independent definition of a word as groups of consecutive letters. The definition works … Read more