This is because the string is got from a ResultSet which returns no value if the string is accessed again.
My position is like this.
ResultSet rst = pst.executeQuery(); //pst is a preparedstatement
value = Integer.parseInt(rst.getString(1).trim().substring(0,<need to get position of '.' here>)
If I give rst.getString(1) again, it gives me an exception as no data found.
I have a workaround to store the string in a temporary variable and access it.
I needed to know if there was something like ‘this’ object to access the current string within a function of that string.
Thanks
You can save rst.getString(1) to new string variable
String st=rst.getString(1);
or use somthing like this
rst.getString(1).split(“\.”)[0].trim()