Thanks Ulf,
Acctually I got the answer from your reply, there is whitespace with
string str because of the empty char array elements when converted to string str. There are two ways to get rid of this
1) Use str=str.trim(); just above the Line 1
2) Or set the char array size to 1.
[ March 26, 2008: Message edited by: gurneeraj singh ]