View this PageEdit this Page (locked)Attachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Sp2002 Midterm Review: String to Hex


Back to Spring 2002 Midterm Review

Comments/answers/critiques?

no idea how this will look:
stringToHex: inputString

"converts a string of ints delimited by a space into an ordered collection of numbers in hex"

|tempArr hexNums|

tempArr := inputString findTokens:(' '). " space is delimiter"
hexNums := OrderedCollection new.
[tempArr isEmpty] whileFalse: "loop through tempArr until it is empty"
[hexNums add: tempArr first asNumber hex. "add first element of tempArr as a number in hex"
tempArr := tempArr allButFirst]. "decrement tempArr"
^hexNums "return orderedCollection"

ok now answer the MVC question for me

Francisco Robles

Or you could do the following:

^ (aString findTokens: ' ') collect: [ :token | token asInteger hex ]


Remember the beauty of Collections and the ability to do this like 'do: collect: reject:' which will step through the collection so you dont have to do a while loop. This one is much cleaner and easier to follow, also takes no temp variables. Brian Pashel

ath0
13 00 00 00
ath0

ath0
Paramount
test
water

hello

asfw
asdf
gdf





aged
mQGiBDgsdTMRBADOe+2+uBW32eCahuHI26fXaJqckBwX3+PYpaY0v0TKQ4e18Eud
JeYnIn5jfXbzYpuKHUftgPg6lqR0CpNzArFfugFofRs6ajmneJFAwW2xO3nZPgoQ
gUagUxLsmuDrYD3GinXTiO5EO0tCgxxO8vQ4Xi8kDkJ7uAUNDnQyndtWnQCg/1c0
lnqEvh1h3JEGAhwqRbCVu+8EAMUSEqR6GaGbSeyIX+IARH2hK+W3+RJW3+sFiO6h
uFvpDOY3DJOLEGVWJi7vqrTV3NaNS4K9EhOpnrUFvncVoOi+NcUBncZFuiBAHT4F
2Ys+rh2RLW+XcN53tIwvwiX8TyG0pKrtJHhp6giff6UWy3r0THYLEaMd8/jzhRsc
9gHuA/wMJqiuTCHnSa1PZuAplakFDtRkDKXH71k5QevQ94494SD3Hin1KIapwCOE
e2xspjV61LKW0o+uh7EdVc6UWW8A07QCiYM+0MWyEGB/IRxqx5T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>WSZ+t;
xƑgsGU ^q8/Et[>C9fK
%D
ɺ3XO0Oކ>l=$(>
2
ߕ+SLhTT3qlŬ~2݈8w^Z

O+






















dfgfd


dfdf


fdfg


eacd


434324








cd






Link to this Page