This is available as Str\to_int in the www repository.
Str\to_int
Returns the given string as an integer, or null if the string isn't numeric
namespace HH\Lib\Str; function to_int( string $string, ): ?int;
string $string
?int