File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

login (upper and lower letter case)

 
Li Jenny
Ranch Hand
Posts: 57
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 46
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 308
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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


 
Li Jenny
Ranch Hand
Posts: 57
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic