codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Please Help Problem on Trim function  romerey at 15:23 on Tuesday, October 16, 2007
 

Im studying java programming and I came to a problem about the trim function. I need to get the string of the checkbox ("Office Visit ") with spaces..and I use trim() to remove the spaces and declared it in a String variable a
Here's my code.
###########################################################
public void itemStateChanged(ItemEvent e)
{
//where (e.getItem().toString = "Office Visit ")

String a = e.getItem().toString().trim();

//now a="Office Visit" or e.getItem().toString().trim()= "Office Visit"

if (a == "Office Visit") //HERE IS THE PROBLEM
{
lblService.setText("$10");
}

}
############################################################
THE PROBLEM IS..the statement (a == "Office Visit") I cannot make the if statement TRUE even the variable a is also "Office Visit"...I think the problem there is the trim() function but I dont know why.Please help!!!








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  mkdirs
•  Re: Web Development Project
•  ** Site Hacked ** javascript inserted...
•  Losing background/text color when converting HTML to PDF
•  hidden div block when displayed, displays at an offset of 200px only in IE 6..
•  help - sketch
•  Re: Perl Script - File Handling.
•  Open a file from website
•  Re: to open 5 terminals from one and also execute different commands on each terminal


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2008