Jump to content

Replace lowercase into Uppercase character


soona

Recommended Posts

How to replace the Lowercase into uppercase for each word of starting character ?for example: "w3schools are superb experts" need to replace "W3schools Are Superb Experts"It is possible to do in javascript ? if it is do . please give some reference or source.Thanks

Link to comment
Share on other sites

http://www.w3schools.com/jsref/jsref_toUpperCase.aspThe problem: you are going to be going through the whole string and only after a blank space making that next single character into an uppercase oneHow I'd think about going at it:-------------------so lets make this easier...break up the string into an array with split()then for each of those elements use the word.substring(0,1).toUpperCase(); make sure to have both halves of the word...put these two substrings back together 'W' +'ord'do that for each word and store them in an array ......for all the elements in this new array use the the js join(' ') which will put a ' ' in between each word ...print out whatever you stored this aslast step, enjoy your sweet victorygive it a try and if you need further help just post or message me...might be a while for a reply from me but someone else might be able to direct you further if you get stuck...always post your code-----------------hope this helps
Link to comment
Share on other sites

You could just apply CSS to the container:

text-transform: capitalize;

It will work for users who have Javascript disabled.Search engines won't register it, though.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...