namedStringResource

open fun namedStringResource(@NonNull context: Context, @NonNull name: String, @NonNull defaultValue: String): String

Retrieves a string resource dynamically by its name. If the resource is not found, it returns the provided default value.

Return

The localized string or the default value if not found.

Parameters

context

The context to access resources.

name

The name of the string resource.

defaultValue

The default value if the string resource is not found.