Package org.python.core.util

## Class StringUtil

- java.lang.Object
- - org.python.core.util.StringUtil

-     public class StringUtil
      extends java.lang.Object

  String Utility methods.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `StringUtil()` |

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static java.lang.String` | `decapitalize​(java.lang.String string)` | Decapitalize a String if it begins with a capital letter, e.g.: FooBar -> fooBar
    `static java.lang.String` | `fromBytes​(byte[] buf)` | Return a new String with chars corresponding to buf.
    `static java.lang.String` | `fromBytes​(byte[] buf, int off, int len)` | Return a new String with chars corresponding to buf from off to off + len.
    `static java.lang.String` | `fromBytes​(java.nio.ByteBuffer buf)` | Return a new String with chars corresponding to buf.
    `static java.lang.String` | `fromBytes​(BaseBytes b)` | Return a new String with chars corresponding to b.
    `static java.lang.String` | `fromBytes​(PyBuffer buf)` | Return a new String with chars corresponding to buf, which is a byte-oriented buffer obtained through the buffer API.
    `static byte[]` | `toBytes​(java.lang.String string)` | Encodes this String into a sequence of bytes.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### StringUtil

          public StringUtil()

  - ### Method Detail

    - #### toBytes

          public static byte[] toBytes​(java.lang.String string)

      Encodes this String into a sequence of bytes. Each byte contains the low-order bits of its corresponding char.
      Parameters:
        `string` - a String value
      Returns:
        a byte array with one byte for each char in string

    - #### fromBytes

          public static java.lang.String fromBytes​(byte[] buf,
                                                   int off,
                                                   int len)

      Return a new String with chars corresponding to buf from off to off + len.
      Parameters:
        `buf` - an array of bytes
        `off` - the initial offset
        `len` - the length
      Returns:
        a new String corresponding to the bytes in buf

    - #### fromBytes

          public static java.lang.String fromBytes​(byte[] buf)

      Return a new String with chars corresponding to buf.
      Parameters:
        `buf` - an array of bytes
      Returns:
        a new String corresponding to the bytes in buf

    - #### fromBytes

          public static java.lang.String fromBytes​(java.nio.ByteBuffer buf)

      Return a new String with chars corresponding to buf.
      Parameters:
        `buf` - a ByteBuffer of bytes
      Returns:
        a new String corresponding to the bytes in buf

    - #### fromBytes

          public static java.lang.String fromBytes​(PyBuffer buf)

      Return a new String with chars corresponding to buf, which is a byte-oriented buffer obtained through the buffer API. It depends on the implementation of `PyBuffer.toString()` provided by each buffer implementation.
      Parameters:
        `buf` - a PyBuffer of bytes
      Returns:
        a new String corresponding to the bytes in buf

    - #### fromBytes

          public static java.lang.String fromBytes​(BaseBytes b)

      Return a new String with chars corresponding to b.
      Parameters:
        `b` - a BaseBytes containing bytes
      Returns:
        a new String corresponding to the bytes in b

    - #### decapitalize

          public static java.lang.String decapitalize​(java.lang.String string)

      Decapitalize a String if it begins with a capital letter, e.g.: FooBar -> fooBar
      Parameters:
        `string` - a String
      Returns:
        a decapitalized String