/** * Trims the builder by removing characters less than or equal to a space * from the beginning and end. * * @return this, to enable chaining */ public StrBuilder trim() { if (size == 0) { return this; } int len = size; char[] buf = buffer; int pos = 0; while (pos < len && buf[pos] <= ' ') { pos++; } while (pos < len && buf[len - 1] <= ' ') { len--; } if (len < size) { delete(len, size); } if (pos > 0) { delete(0, pos); } return this; }
/** * Trims the builder by removing characters less than or equal to a space * from the beginning and end. * * @return this, to enable chaining */ public StrBuilder trim() { if (size == 0) { return this; } int len = size; char[] buf = buffer; int pos = 0; while (pos < len && buf[pos] <= ' ') { pos++; } while (pos < len && buf[len - 1] <= ' ') { len--; } if (len < size) { delete(len, size); } if (pos > 0) { delete(0, pos); } return this; }
/** * Trims the builder by removing characters less than or equal to a space * from the beginning and end. * * @return this, to enable chaining */ public StrBuilder trim() { if (size == 0) { return this; } int len = size; char[] buf = buffer; int pos = 0; while (pos < len && buf[pos] <= ' ') { pos++; } while (pos < len && buf[len - 1] <= ' ') { len--; } if (len < size) { delete(len, size); } if (pos > 0) { delete(0, pos); } return this; }
/** * Trims the builder by removing characters less than or equal to a space * from the beginning and end. * * @return this, to enable chaining */ public StrBuilder trim() { if (size == 0) { return this; } int len = size; char[] buf = buffer; int pos = 0; while (pos < len && buf[pos] <= ' ') { pos++; } while (pos < len && buf[len - 1] <= ' ') { len--; } if (len < size) { delete(len, size); } if (pos > 0) { delete(0, pos); } return this; }
/** * Trims the builder by removing characters less than or equal to a space * from the beginning and end. * * @return this, to enable chaining */ public StrBuilder trim() { if (size == 0) { return this; } int len = size; char[] buf = buffer; int pos = 0; while (pos < len && buf[pos] <= ' ') { pos++; } while (pos < len && buf[len - 1] <= ' ') { len--; } if (len < size) { delete(len, size); } if (pos > 0) { delete(0, pos); } return this; }
/** * Trims the builder by removing characters less than or equal to a space * from the beginning and end. * * @return this, to enable chaining */ public StrBuilder trim() { if (size == 0) { return this; } int len = size; char[] buf = buffer; int pos = 0; while (pos < len && buf[pos] <= ' ') { pos++; } while (pos < len && buf[len - 1] <= ' ') { len--; } if (len < size) { delete(len, size); } if (pos > 0) { delete(0, pos); } return this; }