android-components / mozilla.components.browser.engine.system.matcher / ReversibleString

ReversibleString

abstract class ReversibleString (source)

A String wrapper utility that allows for efficient string reversal. We regularly need to reverse strings. The standard way of doing this in Java would be to copy the string to reverse (e.g. using StringBuffer.reverse()). This seems wasteful when we only read our Strings character by character, in which case can just transpose positions as needed.

Properties

Name Summary
isReversed abstract val isReversed: Boolean
offsetEnd val offsetEnd: Int
offsetStart val offsetStart: Int
string val string: String

Functions

Name Summary
charAt abstract fun charAt(position: Int): Char
length fun length(): Int
Returns the length of this string.
reverse fun reverse(): ReversibleString
Reverses this string.
substring abstract fun substring(startIndex: Int): ReversibleString

Companion Object Functions

Name Summary
create fun create(string: String): ReversibleString
Create a ReversibleString for the provided String.