Class Strings

java.lang.Object
io.keikai.doc.collab.lib0.Strings

public class Strings extends Object
String Utility
  • Field Details

    • MAX_UTF16_CHARACTER

      public static final String MAX_UTF16_CHARACTER
  • Method Details

    • fromCharCode

      public static String fromCharCode(int codePoint)
      Converts a character code to a string.
      Parameters:
      codePoint - The code point to convert.
      Returns:
      The corresponding string.
    • fromCodePoint

      public static String fromCodePoint(int codePoint)
      Converts a code point to a string.
      Parameters:
      codePoint - The code point to convert.
      Returns:
      The corresponding string.
    • toLowerCase

      public static String toLowerCase(String s)
      Converts a string to lower case.
      Parameters:
      s - The string to convert.
      Returns:
      The lower case string.
    • trimLeft

      public static String trimLeft(String s)
      Trims leading whitespace from a string.
      Parameters:
      s - The string to trim.
      Returns:
      The trimmed string.
    • fromCamelCase

      public static String fromCamelCase(String s, String separator)
      Converts a camelCase string to a string with separators.
      Parameters:
      s - The camelCase string.
      separator - The separator to use.
      Returns:
      The converted string.
    • utf8ByteLength

      public static int utf8ByteLength(String str)
      Computes the UTF-8 byte length of a string.
      Parameters:
      str - The string to measure.
      Returns:
      The UTF-8 byte length of the string.
    • encodeUtf8

      public static Uint8Array encodeUtf8(String str)
      Encodes a string as UTF-8.
      Parameters:
      str - The string to encode.
      Returns:
      The encoded string as a byte array.
    • decodeUtf8

      public static String decodeUtf8(Uint8Array buf)
      Decodes a UTF-8 byte array into a string using a polyfill method.
      Parameters:
      buf - The byte array to decode.
      Returns:
      The decoded string.
    • splice

      public static String splice(String str, int index, int remove)
      Splices a string by removing and inserting content at a specific position.
      Parameters:
      str - The initial string.
      index - The starting position.
      remove - The number of characters to remove.
      Returns:
      The modified string.
    • splice

      public static String splice(String str, int index, int remove, String insert)
      Splices a string by removing and inserting content at a specific position.
      Parameters:
      str - The initial string.
      index - The starting position.
      remove - The number of characters to remove.
      insert - The content to insert.
      Returns:
      The modified string.
    • repeat

      public static String repeat(String source, int n)
      Repeats a string multiple times.
      Parameters:
      source - The string to repeat.
      n - The number of times to repeat.
      Returns:
      The repeated string.