I have a String miscFlag which is of size 100. I need to append to this miscFlag starting from index 20 as 0-19 are reserved for some other info. And then append subsequently at certain positions only. Can we do this using StringBuilder/StringBuffer?
This is how i am trying to do it..
StringBuilder info = new StringBuilder(miscFlag);
info.append(" ");
info.append(Misc.toTimestampLiteral(currentDate));//append this from pos 20
info.append(" ");
info.append(formattedStartTime); //append this from pos 40
Here i am not able to specify the position from where to append.
Use the insert method.