@tjieco/library
Version:
TypeScript port of ZXing multi-format 1D/2D barcode image processing library, with Code128 and ITF support.
34 lines (27 loc) • 837 B
text/typescript
export default class StringBuilder {
public constructor(private value: string = '') {
}
public append(s: string | number): StringBuilder {
if (typeof s === 'string') {
this.value += s.toString();
} else {
this.value += String.fromCharCode(s);
}
return this;
}
public length(): number {
return this.value.length;
}
public charAt(n: number): string {
return this.value.charAt(n);
}
public deleteCharAt(n: number) {
this.value = this.value.substr(0, n) + this.value.substring(n + 1);
}
public setCharAt(n: number, c: string) {
this.value = this.value.substr(0, n) + c + this.value.substr(n + 1);
}
public toString(): string {
return this.value;
}
}