Package io.keikai.doc.collab.lib0
Class Strings
- java.lang.Object
-
- io.keikai.doc.collab.lib0.Strings
-
public class Strings extends java.lang.ObjectString Utility
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringMAX_UTF16_CHARACTER
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringdecodeUtf8(Uint8Array buf)Decodes a UTF-8 byte array into a string using a polyfill method.static Uint8ArrayencodeUtf8(java.lang.String str)Encodes a string as UTF-8.static java.lang.StringfromCamelCase(java.lang.String s, java.lang.String separator)Converts a camelCase string to a string with separators.static java.lang.StringfromCharCode(int codePoint)Converts a character code to a string.static java.lang.StringfromCodePoint(int codePoint)Converts a code point to a string.static java.lang.Stringrepeat(java.lang.String source, int n)Repeats a string multiple times.static java.lang.Stringsplice(java.lang.String str, int index, int remove)Splices a string by removing and inserting content at a specific position.static java.lang.Stringsplice(java.lang.String str, int index, int remove, java.lang.String insert)Splices a string by removing and inserting content at a specific position.static java.lang.StringtoLowerCase(java.lang.String s)Converts a string to lower case.static java.lang.StringtrimLeft(java.lang.String s)Trims leading whitespace from a string.static intutf8ByteLength(java.lang.String str)Computes the UTF-8 byte length of a string.
-
-
-
Method Detail
-
fromCharCode
public static java.lang.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 java.lang.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 java.lang.String toLowerCase(java.lang.String s)
Converts a string to lower case.- Parameters:
s- The string to convert.- Returns:
- The lower case string.
-
trimLeft
public static java.lang.String trimLeft(java.lang.String s)
Trims leading whitespace from a string.- Parameters:
s- The string to trim.- Returns:
- The trimmed string.
-
fromCamelCase
public static java.lang.String fromCamelCase(java.lang.String s, java.lang.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(java.lang.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(java.lang.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 java.lang.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 java.lang.String splice(java.lang.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 java.lang.String splice(java.lang.String str, int index, int remove, java.lang.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 java.lang.String repeat(java.lang.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.
-
-