using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace EpsonPrinter.Services { public class PrintString { /// /// An appropriate interval is converted into the length of /// the tab about two texts. And make a printing data. /// /// /// The width of the territory which it prints on is converted into the number of /// characters, and that value is specified. /// /// /// It is necessary as an information for deciding the interval of the text. /// /// /// It is necessary as an information for deciding the interval of the text, too. /// /// printing data. /// public String MakePrintString(int iLineChars, String strBuf, String strPrice) { int bufferWidth = Math.Max(0, iLineChars - strPrice.Length); if (strBuf.Length > bufferWidth) { strBuf = strBuf.Substring(0, bufferWidth); } return strBuf.PadRight(bufferWidth) + strPrice; } } }