Share via


URI.Create(String) Method

Definition

Creates a URI by parsing the given string.

[Android.Runtime.Register("create", "(Ljava/lang/String;)Ljava/net/URI;", "")]
public static Java.Net.URI? Create (string? str);
[<Android.Runtime.Register("create", "(Ljava/lang/String;)Ljava/net/URI;", "")>]
static member Create : string -> Java.Net.URI

Parameters

str
String

The string to be parsed into a URI

Returns

URI

The new URI

Attributes

Remarks

Creates a URI by parsing the given string.

This convenience factory method works as if by invoking the #URI(String) constructor; any URISyntaxException thrown by the constructor is caught and wrapped in a new IllegalArgumentException object, which is then thrown.

This method is provided for use in situations where it is known that the given string is a legal URI, for example for URI constants declared within in a program, and so it would be considered a programming error for the string not to parse as such. The constructors, which throw URISyntaxException directly, should be used situations where a URI is being constructed from user input or from some other source that may be prone to errors.

Java documentation for java.net.URI.create(java.lang.String).

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