File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes login (upper and lower letter case) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "login (upper and lower letter case)" Watch "login (upper and lower letter case)" New topic
Author

login (upper and lower letter case)

Li Jenny
Ranch Hand

Joined: Apr 19, 2010
Posts: 57
how can i conside the upper letter and lower letter case when the user use the user id to login.
it is because when the user table have the user id is 'AM'
when the user type lower letter 'am' that i can login to the system.

how can i match the letter that exactly same as the database then let user login.


if(am==AM),then can't login
if(Am==AM),then can't login.

if(AM==AM),then login
pete reisinger
Ranch Hand

Joined: Dec 30, 2009
Posts: 46
Hi,
I suppose that user name is string.
It means that String is an object, not primitive (primitives start with lower case letter - int, boolean etc., classes start with upper case letter - String, Integer etc.)
"==" is used to compare primitive values, not objects.
So check the String api and you'll find out the right way to compare
two strings (of objects) plus other very useful methods that can help you.
Nicola Garofalo
Ranch Hand

Joined: Apr 10, 2010
Posts: 308
Suppose dbuser is the String you get from your database and user the String the user types to log in



tests whether dbuser and user have the same value or not,

if dbuser = "AM"

and user = "am" (or "Am" or "aM")

dbuser.equals(user) returns false

but if user = "AM" it returns true



Bye,
Nicola
Li Jenny
Ranch Hand

Joined: Apr 19, 2010
Posts: 57
thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: login (upper and lower letter case)