Spotting for hex is hardly complex.

Shift-Enter hex #im

--> implementors of hex, first one I see is in ByteArray.

Shit-Enter hex #se

--> senders of hex. First one is a test in ByteArray

testHex
"self debug: #testHex"
self assert: #[122 43 213 7] hex = '7a2bd507'.
self assert: #[151 193 242 221 249 32 153 72 179 41 49 154 48 193 99 134]
hex = '97c1f2ddf9209948b329319a30c16386'.
self assert: (ByteArray readHexFrom: '7A2BD507') = #[122 43 213 7].
self assert: (ByteArray readHexFrom: '7a2bd507') = #[122 43 213 7].

>From this test, one can spot readHexFrom: which uses lowercase or uppercase
for reading.

And asUppercase, Shift-Enter upper, scrolll down as bit, find
String>>#asUppercase

Spotter is really great at finding stuff, and coupled with tests and
examples it helps in building understanding.

Agreed, this is not the same as looking for stuff as in, say, Java or
Python. I find it better in the long run still.

Phil

On Sat, Jun 17, 2017 at 9:23 PM, horrido <horrido.hobb...@gmail.com> wrote:

> Message 'next' is not understood.
>
> But yes,
>
> UUID new hex asUppercase
>
> works fine.
>
> This is what happens when there is inadequate documentation: you end up
> doing things the *hard* way.
>
> Thanks.
>
>
>
> Sven Van Caekenberghe-2 wrote
> > Why not just
> >
> >   UUIDGenerator default next hex asUppercase.
> >
> > Or even
> >
> >   UUID new hex asUppercase.
> >
> > ?
> >
> > Since you are using #generateBytes:forVersion: (which is an internal
> > method BTW), you must be working in an older Pharo image (older than 6).
> > We replaced the UUIDGenerator class, the class comment in from the newer
> > version.
> >
> >> On 17 Jun 2017, at 16:27, horrido &lt;
>
> > horrido.hobbies@
>
> > &gt; wrote:
> >>
> >> Okay, I figured it out. Here's my method:
> >>
> >> generateUUID
> >>    | aStream hex s x |
> >>    hex := '0123456789ABCDEF'.
> >>    x := ByteArray new: 16.
> >>    UUIDGenerator default generateBytes: x forVersion: 4.
> >>    s := String new: 32.
> >>    aStream := WriteStream on: s.
> >>    x do: [ :each | aStream nextPut: (hex at: each // 16 + 1).
> >>        aStream nextPut: (hex at: each \\ 16 + 1) ].
> >>    ^ s
> >>
> >> Works like a charm. It would've been nice if a similar example was
> >> available
> >> /somewhere/ on the web.
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >> http://forum.world.st/UUIDGenerator-tp4951725p4951731.html
> >> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
> >>
>
>
>
>
>
> --
> View this message in context: http://forum.world.st/UUIDGenerator-
> tp4951725p4951743.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>
>

Reply via email to