Quick and easy fix, you can remove the last character in the string using the substring method:
result.substring(0, result.length()-1);
This return a new string containing the element from 0
to length()-1
meaning everything except the last character