Hi puja, The new string objects will be returned only if there is anything to trim. If u give without any spaces at the ends, the same string will be returned, and therefore the strings will be equal. But if there are anything to trim a different string will be returned and they will become different objects. To understand this u must be aware of the string pool also. -vipin
in other words: NEVER use == to compare Strings unless you explicitly intend to check whether two reference variables refer to the same memory location rather then whether they refer to memory with the same content.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com