# Class SB

java.lang.Object
javajs.util.SB

Direct Known Subclasses:
  `QCJSONWriter.SparseArray`

public class SB extends Object
Interesting thing here is that JavaScript is 3x faster than Java in handling strings. Java StringBuilder is final, unfortunately. I guess they weren't thinking about Java2Script! The reason we have to do this that several overloaded append methods is WAY too expensive

## Constructor Summary

Constructors
Constructor
Description
`SB()`

## Method Summary

Modifier and Type
Method
Description
`SB`
`append(String s)`
`SB`
`appendB(boolean b)`
`SB`
`appendC(char c)`
`void`
`appendCB(char[] cb, int off, int len)`
`SB`
`appendD(double d)`
`SB`
`appendF(float f)`
note that JavaScript could drop off the ".0" in "1.0"
`SB`
`appendI(int i)`
`SB`
`appendO(Object data)`
`SB`
`appendSB(SB buf)`
`char`
`charAt(int i)`
`int`
`charCodeAt(int i)`
`int`
`indexOf(String s)`
`int`
`indexOf2(String s, int i)`
`void`
`insert(int offset, String str)`
`int`
`lastIndexOf(String s)`
`int`
`length()`
`static SB`
`newN(int n)`
`static SB`
`newS(String s)`
`void`
`replace(int start, int end, String str)`
`void`
`setLength(int n)`
`String`
`substring(int i)`
`String`
`substring2(int i, int j)`
`byte[]`
`toBytes(int off, int len)`
simple byte conversion properly implementing UTF-8.
`String`
`toString()`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### SB

public SB()

## Method Details

### newN

public static SB newN(int n)

### newS

public static SB newS(String s)

### append

public SB append(String s)

### appendC

public SB appendC(char c)

### appendI

public SB appendI(int i)

### appendB

public SB appendB(boolean b)

### appendF

public SB appendF(float f)
note that JavaScript could drop off the ".0" in "1.0"

Parameters:
  `f` -
Returns:
  this

### appendD

public SB appendD(double d)

### appendSB

public SB appendSB(SB buf)

### appendO

public SB appendO(Object data)

### appendCB

public void appendCB(char[] cb, int off, int len)

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### length

public int length()

### indexOf

public int indexOf(String s)

### charAt

public char charAt(int i)

### charCodeAt

public int charCodeAt(int i)

### setLength

public void setLength(int n)

### lastIndexOf

public int lastIndexOf(String s)

### indexOf2

public int indexOf2(String s, int i)

### substring

public String substring(int i)

### substring2

public String substring2(int i, int j)

### toBytes

public byte[] toBytes(int off, int len)
simple byte conversion properly implementing UTF-8. * Used for base64 conversion and allows for offset

Parameters:
  `off` -
  `len` - or -1 for full length (then off must = 0)
Returns:
  byte[]

### replace

public void replace(int start, int end, String str)

### insert

public void insert(int offset, String str)