Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: Java
Expertise: Beginner
Oct 27, 2000



Application Security Testing: An Integral Part of DevOps

Convert an Input String Into a Proper String

If you want to convert the input string into a proper string using javascript, this is a simple function that will perform the task:
String.prototype.ProperCase = function() {

      return this.substr(0,1)
                  .toUpperCase() +  
                  this.substr(1, this.length)
                  .replace(/((\s|')[a-z])/g, function($0,$1,$2) {
                        return $1.toUpperCase();  

This function can convert conpound names correctly (eg., "o'brian" will return "O'Brian").
Jose Marcos
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date