pharo icon indicating copy to clipboard operation
pharo copied to clipboard

String as integer

Open jordanmontt opened this issue 6 months ago • 2 comments

Redoing https://github.com/pharo-project/pharo/pull/17299 Because of conflicts

This PR Does the following:

  • Changed the semantics of the method String>>#asInteger Now, it returns a integer ONLY if the complete String is a valid integer, else it raises an exception.
  • Deprecated String>>#asSignedInteger.
  • Copied the old implementation of String>>#asInteger to String>>#extractIntegerPart. That new method behaves exactly as the old asInteger.
  • Changed the semantics of String>>#asUnsignedInteger to just call String>>#asInteger and then getting the absolute value.
  • Updated all senders of String>>#asInteger to call String>>#extractIntegerPart instead.
  • Updated and added test to document this behevior.

This also closes #17277

jordanmontt avatar Aug 29 '25 14:08 jordanmontt

Oups build fails.

Ducasse avatar Aug 29 '25 19:08 Ducasse

We still get a problem

MetacelloNotification: Loaded -> Deprecated14 --- tonel:///builds/workspace/est_and_branch_Pipeline_PR-18503/64/src()
Error: The string '1. 379 forks on GitHub' is not a valid integer
ByteString(Object)>>error:
ByteString(String)>>asInteger
MicOrderedListBlock>>startIndexFrom:
MicOrderedListBlock>>addLineAndReturnNextNode:
MicRootBlock(MicAbstractBlock)>>newBlockFor:parent:
MicRootBlock>>addLineAndReturnNextNode:
MicrodownParser>>handleLine:
MicrodownParser>>handleLine:
MicrodownParser>>parse:
MicrodownParser class>>parse:
Microdown>>parse:
Microdown class>>parse:
MicrodownPresenter>>documentFromString:
StWelcomeTopicMicrodownPresenter>>contents:
StWelcomeBrowser>>newTopicTitle:contents:
StWelcomeBrowser>>topics
StWelcomeBrowser>>updatePresenter
StWelcomeBrowser(SpPresenter)>>initializePrivateHooks
StWelcomeBrowser(SpPresenter)>>initialize
StWelcomeBrowser class(SpPresenter class)>>newApplication:
StWelcomeBrowser class(StPresenter class)>>new
StWelcomeBrowser class>>openForRelease
BaselineOfPharo>>postload:package:

Ducasse avatar Oct 02 '25 19:10 Ducasse