Language

Locale.Builder.SetVariant(String) Method

Definition

Sets the variant.

[Android.Runtime.Register("setVariant", "(Ljava/lang/String;)Ljava/util/Locale$Builder;", "")]
public Java.Util.Locale.Builder SetVariant(string? variant);
[<Android.Runtime.Register("setVariant", "(Ljava/lang/String;)Ljava/util/Locale$Builder;", "")>]
member this.SetVariant : string -> Java.Util.Locale.Builder

Parameters

variant
String

the variant

Returns

This builder.

Attributes

Remarks

Sets the variant. If variant is null or the empty string, the variant in this Builder is removed. A nonempty variant is checked for well-formed subtags, and an IllformedLocaleException is thrown if a subtag fails the check. On Android 5 and 6, a valid variant followed by trailing hyphens or underscores is accepted, and the separators are stored as underscores. Android 7 through 17 reject trailing separators. The Locale class does not impose any syntactic restriction on variant, and the variant value in Locale is case sensitive. To set such a variant, use Of(String, String, String) on Android 16 or later, or the Locale(String, String, String) constructor on earlier versions.

Java reference for java.util.Locale.Builder.setVariant.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to