Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0006859 [Squeak] Kernel feature N/A 01-17-08 00:41 06-13-13 20:52
Reporter Zulq View Status public  
Assigned To
Priority normal Resolution open  
Status pending   Product Version 3.10
Summary 0006859: Integer>>parseFromString:base:ifFail:
Description Add methods to parse integers from entire strings allowing an action when the parse fails. Similar to Integer.parseInt(String) in Java.

For example,

Integer parseFromString: '' base: 10 ifFail: [#fail] "= #fail"
Integer parseFromString: '123' base: 10 ifFail: [#fail] "= 123"
Integer parseFromString: '123abc' base: 10 ifFail: [#fail] "= #fail"
Integer parseFromString: '1.1' base: 10 ifFail: [#fail] "= #fail"


The attached changeset includes an implementation and unit tests. Utility methods have been included so senders do not have to specify the base or fail block if they wish.
Additional Information
Attached Files  IntegerParseFromString.1.cs [^] (5,138 bytes) 01-17-08 00:41

- Relationships

- Notes
(0011688 - 86 - 118 - 118 - 118 - 118 - 118)
Keith_Hodges
01-18-08 12:45

"fix begin"
Installer mantis bug: 6859 fix: 'IntegerParseFromString.1.cs'.
"fix end"
 
(0014362 - 335 - 383 - 383 - 383 - 383 - 383)
nicolas cellier
06-13-13 20:52

Since Squeak 4.x (February 2010), following methods are available:
- readFrom:
- readFrom:base:
- readFrom:ifFail:

The default behaviour in case of failure is to raise a NumberParserError (october 2012 - this would be 4.4).

We could eventually add such a method, but for homogeneity, it would be named
- readFrom:base:ifFail:
 

- Issue History
Date Modified Username Field Change
01-17-08 00:41 Zulq New Issue
01-17-08 00:41 Zulq File Added: IntegerParseFromString.1.cs
01-18-08 12:45 Keith_Hodges Note Added: 0011688
01-10-09 02:00 Keith_Hodges Status new => pending
06-13-13 20:52 nicolas cellier Note Added: 0014362


Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
40 total queries executed.
31 unique queries executed.
Powered by Mantis Bugtracker