?
Solved

Display information from mysql database with only first letter uppercase

Posted on 2013-05-13
3
Medium Priority
?
277 Views
Last Modified: 2013-05-13
Hi all!

I am storing all my data in a mysql database putting it all uppercase (so I am sure about duplicates and I can do non case sensitive search.

Is this a good idea or there are better solutions?

Now the problem is that I am building a jQuery Mobile application and all the text is uppercase.
In php I'd use a couple of commands to make all the text lowercase and then with ucfirst I'd obtain from "TEST" a more pleasing "Test".

How can I do this dinamically in jQuery Mobile?
0
Comment
Question by:ltpitt
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 42

Expert Comment

by:sedgwick
ID: 39160682
if u want to have each word in the variable to be upper case then use the following:
var str = "hello world";
str = str.toLowerCase().replace(/\b[a-z]/g, function(letter) {
    return letter.toUpperCase();
});

Open in new window

result-->  Hello World



if u want just the 1st character then use the following:
var str = "hello world";
str = str.toLowerCase().charAt(0).toUpperCase() + string.slice(1);

Open in new window

result-->  Hello world
0
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 2000 total points
ID: 39162323
You could do it on the browser with just a css class:

.elem {text-transform:capitalize;} will set to lower case and the first letter of each word will be upper case

If you want just the first letter of a string to be upper case than

.elem {text-transform:lowercase;}
.elem:first-letter {text-transform:uppercase;}

Cd&
0
 
LVL 1

Author Closing Comment

by:ltpitt
ID: 39163132
Pure class (pun intended)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses
Course of the Month8 days, 6 hours left to enroll

766 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question