I have this code in Java, the getter methods return Strings:
String stringbuilder="";
stringbuilder = String.format("%d/%d\n", this.getSlotNum(), this.getPortNum());
stringbuilder = stringbuilder+String.format(" " + this.getPortSpeed() +"\n");
stringbuilder = stringbuilder+String.format("%d\n", this.getPortMode());
C# has a StringBuilder Class with an AppendFormat() method that lets me append a formatted string directly to the StringBuilder instance without having to do the concatenation. I don't see an AppendFormat() method in thethn Java StringBuider class. Is there a better way to do what I am trying to do?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.