Package io.keikai.doc.collab.lib0
Class Strings
java.lang.Object
io.keikai.doc.collab.lib0.Strings
String Utility
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic StringdecodeUtf8(Uint8Array buf) Decodes a UTF-8 byte array into a string using a polyfill method.static Uint8ArrayencodeUtf8(String str) Encodes a string as UTF-8.static StringfromCamelCase(String s, String separator) Converts a camelCase string to a string with separators.static StringfromCharCode(int codePoint) Converts a character code to a string.static StringfromCodePoint(int codePoint) Converts a code point to a string.static StringRepeats a string multiple times.static StringSplices a string by removing and inserting content at a specific position.static StringSplices a string by removing and inserting content at a specific position.static StringConverts a string to lower case.static StringTrims leading whitespace from a string.static intutf8ByteLength(String str) Computes the UTF-8 byte length of a string.
-
Field Details
-
MAX_UTF16_CHARACTER
-
-
Method Details
-
fromCharCode
Converts a character code to a string.- Parameters:
codePoint- The code point to convert.- Returns:
- The corresponding string.
-
fromCodePoint
Converts a code point to a string.- Parameters:
codePoint- The code point to convert.- Returns:
- The corresponding string.
-
toLowerCase
Converts a string to lower case.- Parameters:
s- The string to convert.- Returns:
- The lower case string.
-
trimLeft
Trims leading whitespace from a string.- Parameters:
s- The string to trim.- Returns:
- The trimmed string.
-
fromCamelCase
Converts a camelCase string to a string with separators.- Parameters:
s- The camelCase string.separator- The separator to use.- Returns:
- The converted string.
-
utf8ByteLength
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
Encodes a string as UTF-8.- Parameters:
str- The string to encode.- Returns:
- The encoded string as a byte array.
-
decodeUtf8
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
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
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
Repeats a string multiple times.- Parameters:
source- The string to repeat.n- The number of times to repeat.- Returns:
- The repeated string.
-