implementation of 'TryParse'