digitalmars.D.bugs - [Issue 11807] New: Functions to attempt string-to-T conversions (a la C#'s TryParse)
- d-bugmail puremagic.com (28/28) Dec 23 2013 https://d.puremagic.com/issues/show_bug.cgi?id=11807
- d-bugmail puremagic.com (10/10) Dec 23 2013 https://d.puremagic.com/issues/show_bug.cgi?id=11807
- d-bugmail puremagic.com (12/12) Dec 24 2013 https://d.puremagic.com/issues/show_bug.cgi?id=11807
https://d.puremagic.com/issues/show_bug.cgi?id=11807 Summary: Functions to attempt string-to-T conversions (a la Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: peter.alexander.au gmail.com 11:40:23 PST --- std.conv provides 'to' and 'parse', but both will throw exceptions if they fail to convert. The only way to test if a conversion is possible is to call these functions and catch the exception. This isn't a great situation because throwing exceptions is not good for performance. boolean false if the conversion failed and returns the converted value as an out parameter. Like this: bool tryParse(T)(string s, out T value) An alternative API would be to return a Nullable!T See Also: http://msdn.microsoft.com/en-us/library/f02979c7(v=vs.110).aspx -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 23 2013
https://d.puremagic.com/issues/show_bug.cgi?id=11807 bearophile_hugs eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs eml.cc See also Issue 6840 -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 23 2013
https://d.puremagic.com/issues/show_bug.cgi?id=11807 Peter Alexander <peter.alexander.au gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |DUPLICATE 02:35:27 PST --- Duplicate of Issue 6840. *** This issue has been marked as a duplicate of issue 6840 *** -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 24 2013