tryParse method
Parses a string containing a number literal into a number.
Like parse except that this function returns null for invalid inputs
instead of throwing.
Implementation
static num tryParse(String input) {
  String source = input.trim();
  // TODO(lrn): Optimize to detect format and result type in one check.
  return int.tryParse(source) ?? double.tryParse(source);
}