Is there an equivilent of vb.nets StringValue.ToString(“0000”) so that it returns the string as four numbers. I’m trying to work it on :
public static String getNextID(int stationID, String tablename) {
String rtnID;
rtnID = Integer.toString(stationID) + "-" + getNextID(tablename);
return rtnID;
}
So that the value of rtnID is 4 characters long and it’s added 0’s in the right place if needed
Tom
Edit: heres what I now have that isn’t working:
public static String getNextID(int stationID, String tablename) {
String rtnID;
NumberFormat formatter = new DecimalFormat("0000");
String s = formatter.format(String.valueOf(stationID));
rtnID = s + "-" + getNextID(tablename);
return rtnID;
}
With this error: http://pastebin.com/XpvzkC5D
You can use this: