Problem in comparision of two strings.please help..

I am retriving a string password from database and another string from html(user entered one).when i am printing those two strings its printing same strings.But whenever i am comparing strings and printing its not showing equal it is printing as false.what might be the reason.please help me regarding this.Thank you in advance.My cosing is as follows:
while(rs.next())
pwd=rs.getString("password");
System.out.println("pmfg is..."+pwd);
System.out.println("first string..."+pwd);
System.out.println("second string..."+loginpwd);
if(pwd.equals(loginpwd))
System.out.println("true.....");
else
System.out.println("false....");

once you got two string objects ......forget for where they are comming (database or html0 ....focus on those objects ....do the following
1) use trim() function on both strings which removes the whitespaces from front and end
2) use equalsIgnoreCase
if the problem still persists ....then forget your code and sue the SUN people

Similar Messages

  • Sort a string :: Please help.

    Hello Everyone,
    I am having this very simple problem of sorting a String. please help.
         static String sortString(String str){
              List list = Arrays.asList(str);                    
              Collections.sort(list);
              for(int i=0, n=list.size();i<n;i++){
                   System.out.println(","+ list.get(i));
    The function is supposed to take a String and sort it & print it out. This should be simple. Where am I making mistakes? Please help!!

    Hello Everyone,
    I am having this very simple problem of sorting a String. please help.
         static String sortString(String str){
              List list = Arrays.asList(str);                    
              Collections.sort(list);
              for(int i=0, n=list.size();i<n;i++){
                   System.out.println(","+ list.get(i));
                   return str;
    The function is supposed to take a String and sort it & print it out. This should be simple. Where am I making mistakes? Please help!!

  • Comparision of two strings

    Hi all,
    Can any one suggest me how to do comparision of two strings by creating a short lived process?
    i tried but in functions  compare function is not there?
    but compare function is built in function in workbench.
    how to use built in functions in work bench.
    Thanks,
    Bharathi

    Basic String operations are available which could be used for comparision : http://help.adobe.com/en_US/livecycle/10.0/WorkbenchHelp/WS92d06802c76abadb-43a6230012826b ec632-7eb8.html
    Also, you could use executeScript element in workbench : http://help.adobe.com/en_US/livecycle/9.0/workbenchHelp/help.htm?content=000581.html
    Thanks,
    Wasil

  • Until recently I was able to send images in the body of my Yahoo emails. Now, I am getting the message "This message has been truncated", and the email does not go through. I do not have this problem using IE. Could you please help? Thank you.

    Until recently I was able to send images in the body of my Yahoo emails. Now, I am getting the message "This message has been truncated", and the email does not go through. I do not have this problem using IE. Could you please help? Thank you.

    Try this -> http://support.apple.com/kb/TA38632?viewlocale=en_US

  • I do not use or have not signed up for a MobileMe Account but I am getting duplicates in my iCal for some reason.  All discussions I read are pointing to the MobileMe being the problem but it is not.  Please help me.  There must be another reason.

    I do not use or have not signed up for a MobileMe Account but I am getting duplicates in my iCal for some reason.  All discussions I read are pointing to the MobileMe being the problem but it is not.  Please help me.  There must be another reason all my entries appear twice. 

    If you wish to submit comments to Apple, the best way is to use their feedback pages.
    http://www.apple.com/feedback/itunesapp.html
    It's not likely that anyone from Apple will see your comments here among the thousands of other posts.
    Regards.

  • Pass username and password ADFS without using query string, Please help.

    pass username and password ADFS without using query string, Please help.
    I used query string , but it is unsecured to pass credentials over url, with simple tool like httpwatch , anyone can easily get the password and decrypt it.

    Hi,
    According to your post, my understanding is that you had an issue about the ADFS.
    As this issue is related to ADFS, I recommend you post your issue to the forum for ADFS.
    http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=Geneva
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.
    Thank you for your understanding and support.
    Thanks,
    Jason
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Jason Guo
    TechNet Community Support

  • While opening pdf files the menu bar, navigation bar  cracks unobviously and also close and minimise buttons  goes hidden..Facing the problem for last one month. Please help.

    while opening pdf files the menu bar, navigation bar  cracks unobviously and also close and minimise buttons  goes hidden..Facing the problem for last one month. Please help.

    The latest Kaspersky software version is 15.0.1.415 or 15.0.1.415ab.

  • My iphone 4s wifi and bluetooth problem after updating ios 8? please help me...

    my iphone 4s wifi and bluetooth problem after updating ios 8? please help me...

    Hey there Abdulrahim0259,
    I would recommend that you use the following 2 article to help troubleshoot the Wi-Fi and bluetooth issues you are seeing, respectively:
    iOS: Troubleshooting Wi-Fi networks and connections - Apple Support
    And:
    iOS: Troubleshooting Bluetooth connections - Apple Support
    Thank you for using Apple Support Communities.
    All the very best,
    Sterling

  • Problem with streams with CC12.0, Please help

    Hi All,
    We have been facing some issue with the streams(ostringstream, stringstream etc.,) while using them with CC12.0 compiler.
    We are using the ostringstreams as:
    if (log.isBeingLogged(QbLogEntry::OUTPUT_DOC_DATA))
    // log the retrieved data:
    std::ostringstream oss;
    oss << result;
    log.logDebugInfo(..., oss.str());
    if (log.isBeingLogged(QbLogEntry::BILLING_DATA))
    std::ostringstream oss;
    oss << "Billing string: " << attrs.getBillInfo();
    log.logDebugInfo(..., oss.str());
    When the server is compiled using the CC12.0 compiler and we run the test case the server cores. The stack trace looks like:
    t@19 terminated by signal SEGV, bad address: 0xffffffffffffffff
    'where' revealed the following stack trace (abbreviated for clarity):
    [3] free
    [4] operator delete
    [5] std::ios_base::~ios_base
    [6] QbLogEntry::logUlongParm(this = 0xf7b4f4ac, parmName = 0x2fe378 "transactionAttributes", parmValue = 10U), line 221 in "QbLogEntry.C"
    This code works fine with Sun Studio 10.0 but we started facing issues with streams once we migrated to sun studio 12.0
    How can we resolve the issue please help.

    I see two problems with the command line.
    -R/l-n/app/colr/lib/infra/SunOS5.9/WS12.0
    Is this the directory where the compiler is installed? If so, remove this option. You should not use -I, -L, or -R options that point into the compiler installation area. The CC driver will add such options as needed.
    -D_RWSTD_SOLARIS_THREADS
    This macro definition is likely to cause program crashes. We do not support user modification of any of the library configuration macros (those starting with _RWSTD). The runtime library is built with a set of configuration macros. If you compile your program with a different set, the object code generated by your application will not be compatible with the runtime library.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Converting a long to a string  (PLEASE HELP)

    I am trying to convert a long to a string so that I can put it into a vector. I have this:
    long fileSize = 0;
    String fileModDate = null;
    Vector fileList = new Vector();
         ~~~~~~~
    File [] files = myDir.listFiles();
    for (int i = 0; i<files.length; i++){
    fileSize = files.length();
    String s = fileSize.toString();
    //do the same for the mod date
    fileModDate = files[i].lastModified();
    When i try this, i get an error that long can not be dereferenced. Can anyone please help?

    There are two ways to solve this problem. You are trying to convert a primative type to a string without using its wrapper function (Long). So if you created a long variable as a (Long) object you could call its toString() method and this would work...
    The other way is to simply use the static method in the String class valueOf(long) as follows:
    String longString = String.valueOf(i);Hope this helps.
    Mark

  • Problem installing Adobe Photoshop CS4. Please help me.

    Hi Geeks,
    I am stuck with Adobe Photoshop CS4 (Trial) installation since last two days. I am desperately looking for help to get rid of this problem.
    My Problem:
    At the end of installation of Adobe Photoshop CS4 (Trial) i was prompted with en error
    message stating some of the components were not installed.  When I check the more information button provided in the error message window, it showed below error.
    “Adobe Photoshop CS4 English Language Pack Error: Error 2.”
    Still I could find the installed Photoshop in C:\Program files\Adobe\Adobe Photoshop CS4\Photoshop.exe
    When I executed above file; application showed below error message and close it.
    “Some of the application components are missing from the application directory, Please reinstall the application.”
    I just try to run Adobe Device Central CS4 which was installed along with it.  It showed below error message.
    “The Localized resource files for this application could not be loaded. Please reinstall or repair the application and try again.”
    So My Problem is I am unable to open Photoshop CS4 after its unsuccessful installation.
    I spent more than a day in different ways as I explained below in more info section.  I am desperately looking for helping hands to fix this problem.
    I ever find this kind of difficulty with any other components installation in my 10 years of development experience.  Please help me.
    More info:
    (1) I have downloaded Adobe Photoshop CS4 (Trial) in this month (July 09) from adobe official site.
    (2) My PC OS Windows XP SP3.
    (3) Prior to install Photoshop CS4 I had Acrobat reader 8 and Adobe DW CS4.
    (4) After I read some stuff on net, I downloaded both Windows install Clean up and CS4InstallerDatabaseUtility.exe.
    (5) First I uninstalled all DW CS4 and Photoshop CS4 using add/remove then rebooted.
        then ran CS4InstallerDatabaseUtility.exe (which really did not removed as it did not
        find any Adobe component), then installed Photoshop CS4. No luck. same error.
    (6) This time I ran CS4InstallerDatabaseUtility.exe and removed DW CS4, Photoshop CS4 and flash and rebooted. Then I ran Photoshop CS4 as Administrator. Same thing repeated at the end of installation and when I tried to open the photoshop.  Finding a real hard time with it.
    Any kind of help to get rid of this problem would be highly appreciated.
    Thanks in advance.
    Regards,
    R Sunil.

    PS CS4 software itself has to be installed as Admin. Put the downloaded folder on the desktop (if not there already). Open the folder and right click on the .exe file and choose run as Admin.
    Install on C drive is the best stable choice.
    Before you do all this make the anti-virus is turned off. If windows defender is running turn that off too. If Adobe reader is installed renove that. Ensure no other adobe products are running in the background.
    During install the process will hang at 90 percent for about 10 to 15 mins. This is normal.
    After the software is installed reboot computer.
    After reboot go to start, All Programs and right click on PS CS4. Click on properties, Compatibility and check run as Admin. Hit Apply and OK to close. Run PS CS4 and update to 11.0.1
    Be Advised:
    Now the biggest problem you might run into is that the trial install went too far and failed. If this happened you cannot re-install PS CS4 trial because of the DRM that is hidden in the registry hive. The hidden DRM prevents people from installing the trial more then once and limits the trial at 30 days. There is nothing you can do other then nuking the hard drive and a fresh install of your operating system.

  • ITunes has encountered a problem and needs to close.  PLEASE HELP ME!!!!!!!

    I bought the Apple airport router I installed it with the provided disc and that same day my iTunes would not come up. For window users I get the box that reads iTunes has encountered a problem and needs to close. We are sorry for the inconvenience with a box that you click to Send Error Report. Here is the error……… AppName: itunes.exe AppVer: 7.6.2.9 ModName: unknown
    ModVer: 0.0.0.0 Offset: 000a019a
    I figured that my music files somehow were corrupt and that shi_ happens. Well a week later I was having troubles with the Apple router so I returned it and uninstalled it from my program files C drive. Then I gave iTunes another shot and it opened. Weird, I know. Well my next router was a Net gear it worked fine but it lagged on COD4 while online with my PC, so I returned it. Then I bought a Belkin - N1 Vision Wireless-N Wireless Router and it did not come with an install disc just plug and play. That very same day my iTunes gave me that **** error again. This time I can’t try to uninstall it from my program files because it was plug and play. I already tried to do a system restore and I shut down my PC and start it back up without the router plugged in and still no luck. I also tried to repair iTunes and that didn’t work. I went to the Geek Squad and they tell me the two issues can’t be related (a router not allowing my iTunes to run). My computer is running on Windows XP Pro. I’m now playing my music through Windows Media Player. I’m in ****!!!! Can someone please help me!!!!! I also tried a few things on iTunes support and they didn’t work. I will be more than happy finically facilitate someone for helping me get my iTunes up and running like usual. Dallas @ [email protected] I’ll be checking this thread every day. PLEASE HELP!!!!!!!!!!!!!!!!!

    ,......"The enstaller encountered errors before the requested operations for Quicktime could not be completed. To retry these operations at a later time, please run the installer again."
    Checking on things that can cause QuickTime launch errors and install/uninstall errors now.
    Have you at any stage installed an ACE or K-Lite Mega Codec Pack, any copies of the programs QT Alternative, QT Lite or Storm Codec, or any media converter programs that can convert files into QuickTime readable formats?
    (I'm checking on these things because depending on the versions of the programs/codec-packs, these can install earlier versions of QuickTime componentry on a PC, which can interfere with the running/installing of a higher version of QuickTime.)

  • Connecting two programs - please help

    Hi, I'm new here, so I'd like to say 'hi' to everyone :) I'm a freshman in the java comunity, so please be gentle.
    Firs of all I'd like to ask how to resolve the first problem. I've got the code which is responsible for convert a html document to the txt file. It looks like:
    import javax.swing.text.html.parser.*;
    import javax.swing.text.html.*;
    import javax.swing.text.*;
    import javax.swing.*;
    import java.io.*;
    public class TextFromHtml extends HTMLEditorKit.ParserCallback{
    static String trimmss(String o){
       return (o.trim()).replaceAll("\\s+", " ");
    public void handleText(char[] data, int pos){
    try{
          String o = new String(data);
          PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter("test.txt", true)));
          o = trimmss(o);
          pw.println(o);
          //pw.close();
         catch (IOException exc){}      
    System.out.println(new String(data));
      public static void main(String args[]){
        try{
          String s = JOptionPane.showInputDialog("Enter the name of the file you want to convert from html to txt.");     
          Reader r = new FileReader(s);
          ParserDelegator parser = new ParserDelegator();
          HTMLEditorKit.ParserCallback callback = new TextFromHtml();
          parser.parse(r, callback, true); 
        catch (IOException e){
          e.printStackTrace();
         System.exit(0);
    }But unfortunately I don't know how to change this code to obtain such situation as making a new txt file without blank spaces > 0 and erasing the \n new lines. I'd like to get a txt file, which contains of line-by-line text. Could you please help me - tell & show me how to do that? I'd be very grateful
    Regards, skullscape.

    Hi Skullscape,
    My apologies for not getting a response on this forum, but this may have been because this is a fairly generic Java programming question, rather than an issue specific to the JSE product, the purpose of this particular forum.
    So may I suggest that you check out http://java.sun.com/ which has a full set of facilities for those such as yourself who are new to Java programming.
    Although by now you nay not be such a novice :-)

  • Problem getting wi-fi to work. please help me.

    Hi,
    In my home, I have AT&T/Bellsouth DSL internet service with a download speed of 1.5 megabits and a Belkin wireless router. I have never had any problems whatsoever in getting any device to work with the network. I currently use two laptop computers, and stream Sirius internet radio over it. Well now with my new iPhone, it doesn't work on my network at all. I can connect my iphone to my network, it shows that I'm connected with a strong signal with all 3 bars on the icon on the screen, though I get zero internet usage with the phone. I went to the Apple Store yesterday and it connected to their network just fine and I had blazing speed, so I know that there doesn't seem to be anything wrong with my iPhone. Would someone please help me? I would greatly appreciate it.
    Thanks,
    Harbeth
    iMac G5 & BlackBook Mac OS X (10.4.10)

    Okay, I now have a solution. I found this information in another thread. I implemented it, and now my iPhone works on my network.
    "After reading many posts with many helpful suggestions:
    I was able to make my iphone work on my home wirless connection by choosing from the main screen
    "settings" then "Wi-fi" then under "Choose a Network" I selected my home network (Belkin) (little blue arrow at the end) then under "IP Address" I chose the "static" button clicked on the "DNS" numbers and entered the the DNS addresses of my router as shown on the summary page when I logged on to my router from my home computer. As for how to log on to your router and find your DNS addresses refer to your router documentation. I tried many of the other solutions and this is so far the only way I could get a connection to actually work. It would always show the strong network signal on my phone but would not be able to connect to the internet and find the server. Like some others who have posted, until this solution I was able to borrow a connection from my neighbor with no problems but his router was a linksys. Hopefully Apple will be patching up all these issues soon.
    I have no idea if this solution is permanent or even a good idea but it worked for me. Your mileage may vary. I do love the phone."
    Thanks to everyone for responding.
    Happy iPhoning,
    Harbeth
    iMac G5 & BlacBook

  • Problem with simple piece of code - please help

    For some reason the following code will not compile - im being told i need a return - however i cant see where or why?
    Please help
    Thanks
    * Author: hc01pl
    * Created: 16 April 2002 14:45:48
    * Modified: 16 April 2002 14:45:48
    //package csci1003testprograms.Gui;
    public class Task2
         // students id number
         private int id;
         // students name
         private String name;
         // students mark 1
         private int mark1;
         // students mark 2
         private int mark2;
         // constucts a student with given id, name and two module marks
         public void StudentMarks(int aID, String aName, int aMark1, int aMark2)
              id = aID;
              name = aName;
              mark1 = aMark1;
              mark2 = aMark2;
         // returns student id
         public int getID()
              return id;
         //returns student name
         public String getName()
              return name;
         //returns student's first mark
         public int getMark1()
              return mark1;
         //returns student's first mark
         public int getMark2()
              return mark2;
         //sets the first mark of a student
         public void setMark1(int aMark1)
              mark1 = aMark1;
         //sets the second mark of a student
         public void setMark2(int aMark2)
              mark2 = aMark2;
         //returns the grade of a student
         public String getGrade()
              int mark = mark1 + mark2;
              if (mark<30)
                   System.out.println("F");
              else
                   if (mark>=30&& mark<40)
                        System.out.println("U");
                   else
                        if (mark>=40&& mark<50)
                             System.out.println("D");
                        else
                             if (mark>=50&& mark<60)
                                  System.out.println("C");
                             else
                                  if (mark>=60&& mark<70)
                                       System.out.println("B");
                                  else
                                       if (mark>=70&& mark<80)
                                            System.out.println("A");
                                       else
                                            if (mark>=80)
                                                 System.out.println("A*");

    The answer is given by asantoas. You need a return statement. Because your method
    public String getGrade(), has a return type String , so the method expects to return a String datatype.
    If you don't want to return any thing. Then declare the method as public void getGrade()
    Regards
    Deepa Datar

Maybe you are looking for