• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
The Electric Toolbox Blog

The Electric Toolbox Blog

Linux, Apache, Nginx, MySQL, Javascript and PHP articles

  • Applications
  • FCKEditor
  • Apache
  • Windows
  • Contact Us
Home / Upper and lower case strings with Javascript

Upper and lower case strings with Javascript

I needed to convert a string to lower case the other day with Javascript and wasn’t sure of the exact function name, so turned to my blog but was surprised I didn’t have a post about how to do this… so here it is now.

Lower case a string with Javascript

Yes, it is as obvious as I thought it was, but making a string lower case isn’t something I need to do very often (almost never) which is why I went to look it up. And now that I’ve written a post about it I’ll probably never need to look it up again.

To lower case a string in Javascript

string.toLowerCase()

For example:

alert( "AAA".toLowerCase() );

or

var foo = "AAA";
alert( foo.toLowerCase() );

Both of the above examples will show "aaa" in a alert dialog box.

Upper case a string with Javascript

To upper case a string in Javascript

string.toUpperCase()

For example:

alert( "aaa".toUpperCase() );

or

var foo = "aaa";
alert( foo.toUpperCase() );

Both of the above examples will show "AAA" in a alert dialog box.

Check Out These Related posts:

  1. Type casting with PHP
  2. Multiple variable assignment with Javascript
  3. Upper case and lower case strings with MySQL
  4. Trimming strings with Javascript

Filed Under: Javascript

Primary Sidebar

Categories

  • Apache
  • Applications
  • Article
  • Case Studies
  • Email Servers
  • FCKEditor
  • HTML And CSS
  • Javascript
  • Linux/Unix/BSD
  • Microsoft SQL Server
  • Miscellaneous Postings
  • MySql
  • Networking
  • Nginx Web Server
  • Offsite Articles
  • OSX
  • PHP
  • Quick Tips
  • RFC – Request for Comments
  • SilverStripe
  • VMWare
  • VPN
  • Windows
  • WordPress

Recent Posts

  • Vim Show Line Numbers
  • Add User To Group Linux
  • Chmod 777 Tutorial
  • How to Copy Directory Linux
  • Linux create user

Copyright © 2021. ElectricToolBox. All Rights Reserved.

  • Contact Us
  • Copyright Info
  • Privacy Policy
  • Sitemap