Boolean.Parse Método
Definição
Sobrecargas
| Parse(ReadOnlySpan<Char>) |
Converte a representação de intervalo especificada de um valor lógico para seu Boolean equivalente.Converts the specified span representation of a logical value to its Boolean equivalent. |
| Parse(String) |
Converte a representação de cadeia de caracteres especificada de um valor lógico em seu Boolean equivalente.Converts the specified string representation of a logical value to its Boolean equivalent. |
Parse(ReadOnlySpan<Char>)
public:
static bool Parse(ReadOnlySpan<char> value);
public static bool Parse (ReadOnlySpan<char> value);
static member Parse : ReadOnlySpan<char> -> bool
Public Shared Function Parse (value As ReadOnlySpan(Of Char)) As Boolean
Parâmetros
- value
- ReadOnlySpan<Char>
Um intervalo que contém os caracteres que representam o valor a ser convertido.A span containing the characters representing the value to convert.
Retornos
true se value for equivalente a TrueString; false se value for equivalente a FalseString.true if value is equivalent to TrueString; false if value is equivalent to FalseString.
Aplica-se a
Parse(String)
public:
static bool Parse(System::String ^ value);
public static bool Parse (string value);
static member Parse : string -> bool
Public Shared Function Parse (value As String) As Boolean
Parâmetros
- value
- String
Uma cadeia de caracteres que contém o valor a ser convertido.A string containing the value to convert.
Retornos
true se value for equivalente a TrueString; false se value for equivalente a FalseString.true if value is equivalent to TrueString; false if value is equivalent to FalseString.
Exceções
value é null.value is null.
value não é equivalente a TrueString ou FalseString.value is not equivalent to TrueString or FalseString.
Exemplos
O exemplo de código a seguir ilustra o uso do Parse método.The following code example illustrates the use of Parse method.
Boolean val;
String^ input;
input = Boolean::TrueString;
val = Boolean::Parse( input );
Console::WriteLine( "'{0}' parsed as {1}", input, val );
// The example displays the following output:
// 'True' parsed as True
bool val;
string input;
input = bool.TrueString;
val = bool.Parse(input);
Console.WriteLine("'{0}' parsed as {1}", input, val);
// The example displays the following output:
// 'True' parsed as True
Dim val As Boolean
Dim input As String
input = Boolean.TrueString
val = Boolean.Parse(input)
Console.WriteLine("'{0}' parsed as {1}", input, val)
' The example displays the following output:
' 'True' parsed as True
Comentários
O value parâmetro, opcionalmente precedido ou no final do espaço em branco, deve conter TrueString ou FalseString ; caso contrário, uma exceção é lançada.The value parameter, optionally preceded or trailed by white space, must contain either TrueString or FalseString; otherwise, an exception is thrown. A comparação não diferencia maiúsculas de minúsculas.The comparison is case-insensitive.