Skip to content

String as integer#18503

Open
jordanmontt wants to merge 11 commits into
pharo-project:Pharo14from
jordanmontt:this-one
Open

String as integer#18503
jordanmontt wants to merge 11 commits into
pharo-project:Pharo14from
jordanmontt:this-one

Conversation

@jordanmontt
Copy link
Copy Markdown
Member

Redoing #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

@Ducasse
Copy link
Copy Markdown
Member

Ducasse commented Aug 29, 2025

Oups build fails.

@Ducasse
Copy link
Copy Markdown
Member

Ducasse commented Oct 2, 2025

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:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

String>>#asInteger has not defined behavior

3 participants