Briefly, you cannot and (for a different reason) you should not. The IsbnVerifierTest class defines the API; the method must be isValidIsbn: aString and it MUST be on the instance side. The reason why you shouldn't is that an empty string should NOT be a special case. This is a problem where the design style described by Dijkstra in "A Discipline of Programming" and further fleshed out by Reynolds and Gries in related books pays off. You want to inspect all the characters of the string once each in a single left-to-right loop.
On Wed, 2 Sep 2020 at 18:19, Roelof Wobben via Pharo-users < pharo-users@lists.pharo.org> wrote: > Hello, > > I have now a challenge where I have to validate a ISBN number. > > Can I do something like this on the class side : > > (string isEmpty) > ifTrrue: [ ^ false] > ifFalse: [ digits:= something. > controlDigit := something. > self validateISBNNumber] > > where on the validateISBNNumber I use the instance variables digits and > controlDigit to validate the ISBN number on the instance side. > > Roelof > > > > > > > >