Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Parse

Parses an int from this string starting at a byte offset.
Read time 2 minutesLast updated 6 days ago

Definition

  • Type: Method
  • Namespace: Unity.Collections
  • Assembly: UnityEngine.ManagedKernelModule

Parse<T>(T, int, int)

Parses an int from this string starting at a byte offset.
public static ParseError Parse<T>(this ref T fs, ref int offset, ref int output) where T : unmanaged, INativeList<byte>, IUTF8Bytes

Parameters

fs

T
The string from which to parse.

offset

A reference to an index of the byte at which to parse an int.

output

Outputs the parsed int. Ignore if parsing fails.

Returns

Type

Description

ParseErrorParseError.None if successful. Otherwise returns ParseError.Overflow or ParseError.Syntax.

Remarks

Stops parsing after the last number character. (Unlike parsing methods in other API's, this method does not expect to necessarily parse the entire string.)
The parsed value is bitwise-identical to the result of System.Int32.Parse.

Parse<T>(T, int, uint)

Parses an uint from this string starting at a byte offset.
public static ParseError Parse<T>(this ref T fs, ref int offset, ref uint output) where T : unmanaged, INativeList<byte>, IUTF8Bytes

Parameters

fs

T
The string from which to parse.

offset

A reference to an index of the byte at which to parse a uint.

output

Outputs the parsed uint. Ignore if parsing fails.

Returns

Type

Description

ParseErrorParseError.None if successful. Otherwise returns ParseError.Overflow or ParseError.Syntax.

Remarks

Stops parsing after the last number character. (Unlike parsing methods in other API's, this method does not expect to necessarily parse the entire string.)
The parsed value is bitwise-identical to the result of System.UInt32.Parse.

Parse<T>(T, int, float, char)

Parses a float from this string starting at a byte offset.
public static ParseError Parse<T>(this ref T fs, ref int offset, ref float output, char decimalSeparator = '.') where T : unmanaged, INativeList<byte>, IUTF8Bytes

Parameters

fs

T
The string from which to parse.

offset

Index of the byte at which to parse a float.

output

Outputs the parsed float. Ignore if parsing fails.

decimalSeparator

The character used to separate the integer part of the number from the fractional part. Defaults to '.' (period).

Returns

Type

Description

ParseErrorParseError.None if successful. Otherwise returns ParseError.Overflow, ParseError.Underflow, or ParseError.Syntax.

Remarks

The parsed value is bitwise-identical to the result of System.Single.Parse.