void XStr::line_append_padding(const char c, int lineWidth) { XStr xs; int count = 0; for(unsigned int i=0; i<len; i++) { if(s[i] == '\n') { // found line ending while(count++ < lineWidth-1) xs << " "; xs << c << "\n"; count=0; } else if(s[i] == '\t') { // found tab, convert to 2 spaces xs << " "; count+=2; } else { // found non-line ending xs << s[i]; count++; } } delete[] s; initTo(xs.charstar()); }
void XStr::line_append(const char c) { XStr xs; for(unsigned int i=0; i<len; i++) { if(s[i] == '\n') xs << c << "\n"; else xs << s[i]; } delete[] s; initTo(xs.charstar()); }