File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes  Special characer in Database + problem in trimming it with trim() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark " Special characer in Database + problem in trimming it with trim()" Watch " Special characer in Database + problem in trimming it with trim()" New topic
Author

Special characer in Database + problem in trimming it with trim()

Raza Mohd
Ranch Hand

Joined: Jan 20, 2010
Posts: 247

hi all,

i am having a Database where one column contain special Character .

i want to trim this special character as i am interested in the value excluding this special character.

i used trim() method of java but it did not work and searched a lot but did not get any answer.

can anybody please tell me how to solve this issue as i stuck for a long time doing this.

Thanks
Raza!


Good luck!!
A small leak can sink a Gigantic ship.>
Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 820

trim() removes whitespace characters. Is the special character a whitespace character? Can you give us an example of the column contents you are dealing with?
Raza Mohd
Ranch Hand

Joined: Jan 20, 2010
Posts: 247

actually i dont know but i am unable to trim it with trim()

it is something like pi sign in mathematics.

please help me.

Thanks.
Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 820

what happens when you try something like:
Raza Mohd
Ranch Hand

Joined: Jan 20, 2010
Posts: 247

Actually i am fetching the data from database which is having this special character.

but when i trim it i dont get the data excluded from that special character.

Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 820

Raza Mohd wrote:Actually i am fetching the data from database which is having this special character.

but when i trim it i dont get the data excluded from that special character.



right. don't use trim(). trim only gets rid of whitespace. a symbol that looks like pi does not qualify as whitespace.
what happens when you use the replaceAll() example against the result of the fetch from the database?

also, can you output the string you are getting from the database?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Special characer in Database + problem in trimming it with trim()