Class

RemoteString

Abstract base class for all remote string representations.

RevenueCat

RevenueCat

Add subscriptions to your apps in minutes

Ad Get started for free
Android
public abstract class RemoteString internal constructor() : BaseRemoteState<String>()

Abstract base class for all remote string representations.

RemoteString represents a string value that can be a constant, a named variable, or a dynamic expression (e.g., a concatenation).

Functions

plus

public operator fun plus(v: RemoteString): RemoteString

Concatenates this RemoteString with another RemoteString.

Parameters

v The other RemoteString to concatenate.

Returns

A new MutableRemoteString representing the concatenated string.

plus

@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
    public operator fun plus(v: String): RemoteString

Concatenates this RemoteString with a String.

Parameters

v The String to concatenate.

Returns

A new MutableRemoteString representing the concatenated string.

substring

@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
    public fun substring(start: Int): RemoteString

Returns a RemoteString that evaluates to a substring of this RemoteString.

Parameters

start The inclusive index of the character at which the substring starts.

Returns

A new MutableRemoteString representing the substring.

uppercase

public fun uppercase(): RemoteString

Returns a RemoteString that evaluates to a upper case version of this RemoteString using the system default locale.

Returns

A new MutableRemoteString representing the upper case version of this string.

lowercase

public fun lowercase(): RemoteString

Returns a RemoteString that evaluates to a lower case version of this RemoteString using the system default locale.

Returns

A new MutableRemoteString representing the lower case version of this string.

trim

public fun trim(): RemoteString

Returns a RemoteString that evaluates to the trimmed version of this this RemoteString where leading and trailing whitespace characters have been removed.

Returns

A new MutableRemoteString representing the trimmed version of this string.

substring

@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
    public fun substring(start: RemoteInt): RemoteString

Returns a RemoteString that evaluates to a substring of this RemoteString. The substring starts at a dynamic start index (represented by a RemoteInt) and extends to the end of the string.

Parameters

start The RemoteInt representing the inclusive index of the character at which the substring starts.

Returns

A new MutableRemoteString representing the substring.

substring

@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
    public fun substring(start: Int, end: Int): RemoteString

Returns a RemoteString that evaluates to a substring of this RemoteString. The substring starts at a fixed start index and ends before a fixed end index.

Parameters

start The inclusive index of the character at which the substring starts.
end The exclusive index after the last character of the substring.

Returns

A new MutableRemoteString representing the substring.

substring

@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
    public fun substring(start: Int, end: RemoteInt): RemoteString

Returns a RemoteString that evaluates to a substring of this RemoteString. The substring starts at a fixed start index and ends before a dynamic end index.

Parameters

start The inclusive index of the character at which the substring starts.
end The RemoteInt representing the exclusive index after the last character of the substring.

Returns

A new MutableRemoteString representing the substring.

substring

@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
    public fun substring(start: RemoteInt, end: RemoteInt): RemoteString

Returns a RemoteString that evaluates to a substring of this RemoteString. Both the start and end indices are dynamic, represented by RemoteInts.

Parameters

start The RemoteInt representing the inclusive index of the character at which the substring starts.
end The RemoteInt representing the exclusive index after the last character of the substring.

Returns

A new MutableRemoteString representing the substring.

computeRequiredCodePointSet

@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
    public abstract fun computeRequiredCodePointSet(
        creationState: RemoteComposeCreationState
    ): Set<String>?

Attempts to compute the set of unicode code points that can occur in this string, or null if that can\'t be statically determined (e.g. named strings rely on external state).

This is useful if you need to compute the subset of a font that\'s required to render the string.

Parameters

creationState The RemoteComposeCreationState context this is being evaluated within.

Returns

The set of unicode code points that can occur in this string, or null if that can\'t be statically determined .

Companion Object

Methods


invoke

Android
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
        public operator fun invoke(v: String): RemoteString

Creates a RemoteString instance from a constant String literal.

Parameters

v The constant String value.

Returns

A MutableRemoteString representing the constant string.

createNamedRemoteString

Android
@JvmStatic
        @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
        public fun createNamedRemoteString(
            name: String,
            defaultValue: String,
            domain: RemoteState.Domain = RemoteState.Domain.User,
        ): RemoteString

Creates a named RemoteString with an initial value.

Parameters

name A unique name to identify this state within its domain.
defaultValue The initial String value for the named remote string.
domain The domain for the named state. Defaults to RemoteState.Domain.User.

Returns

A RemoteString representing the named string.