@micosmo/core
Version:
Core Javascript language extensions
48 lines (33 loc) • 2.02 kB
Markdown
var { StringBuilder } = require('@micosmo/core/string');
const sb = StringBuilder();
```
Export | Description
-------- | -----------
StringBuilder() | Returns a new StringBuilder helper object that joins one or more string segments into a single string. String concatenation is delayed until the full string is required using the array join method to construct the string.
Method | Description
------ | -----------
name() | Returns the name of the object ('StringBuilder').
append(s) | Appends a string segment. Argument *s* is cast to a String.
pop() | Pop the last segment appended.
clear() | Clear and initialise the StringBuilder
atGet(idx) | Return the character at the specified index position
length() | Return the length of the current string being built
segmentCount() | Return the current number of string segments
toString() | Return a string resulting from joining the string segments
substr(...args) | See String.substr
substring(...args) | See String.substring
splice(...args) | See String.splice
## LICENSE
ISC - Internet Systems Consortium
Copyright 2019 Micosmo ([www.micosmo.com](http://www.micosmo.com))
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
String services.
```javascript