Dela via


HeaderUtilities.TryParseNonNegativeInt32(StringSegment, Int32) Method

Definition

Try to convert a string representation of a positive number to its 64-bit signed integer equivalent. A return value indicates whether the conversion succeeded or failed.

public:
 static bool TryParseNonNegativeInt32(Microsoft::Extensions::Primitives::StringSegment value, [Runtime::InteropServices::Out] int % result);
public static bool TryParseNonNegativeInt32 (Microsoft.Extensions.Primitives.StringSegment value, out int result);
static member TryParseNonNegativeInt32 : Microsoft.Extensions.Primitives.StringSegment * int -> bool
Public Shared Function TryParseNonNegativeInt32 (value As StringSegment, ByRef result As Integer) As Boolean

Parameters

value
StringSegment

A string containing a number to convert.

result
Int32

When this method returns, contains the 64-bit signed integer value equivalent of the number contained in the string, if the conversion succeeded, or zero if the conversion failed. The conversion fails if the string is null or String.Empty, is not of the correct format, is negative, or represents a number greater than Int64.MaxValue. This parameter is passed uninitialized; any value originally supplied in result will be overwritten.

Returns

true if parsing succeeded; otherwise, false.

Applies to