Files
2026-05-31 11:06:50 +02:00

20 lines
882 B
C#

namespace EonaCat.FirstLight.SaveTransfer.VdfGenerator;
public static class NumberParser
{
/// <summary>
/// Parses the specified string as a 32-bit signed integer value.
/// </summary>
/// <param name="s">The string representation of the number to parse.</param>
/// <returns>The parsed 32-bit signed integer value if the parse operation succeeds; otherwise, 0.</returns>
public static int ParseInt(string s)
=> int.TryParse(s, out var v) ? v : 0;
/// <summary>
/// Parses the specified string representation of a number to a 64-bit signed integer.
/// </summary>
/// <param name="s">The string containing the number to parse.</param>
/// <returns>The parsed 64-bit signed integer value if parsing succeeds; otherwise, 0.</returns>
public static long ParseLong(string s)
=> long.TryParse(s, out var v) ? v : 0;
}