sumim #2546(2007/08/26 14:17 GMT) [ Smalltalk ] Rating1/1=1.00
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| in delimiters candidates | in := 'aaa abc-hidden.png>hoge-big.jpeg ---foo-hidden-small.gif|^_^a.bmp --hiddena-hoge.png<=not hidden~~ --small.jpg<=not small(^_^) normal-small-big.hoge'. delimiters := in asSet reject: [:each | each isLetter or: ['-.' includes: each]]. candidates := (in findTokens: delimiters) reject: [:each | each = each sansPeriodSuffix]. World findATranscript: nil. candidates do: [:cand | | strm next ext size hidden | strm := (cand findTokens: '-.') reversed readStream. ext := strm next. next := strm next. (strm peek notNil and: [#(small big) includes: next]) ifTrue: [size := next. next := strm next] ifFalse: [size := 'normal']. (hidden := strm peek notNil and: [next = #hidden]) ifTrue: [next := strm next]. Transcript cr; show: {#name->next. #ext->ext. #size->size. #hidden->hidden}]
Rating1/1=1.00-0+
[ reply ]
sumim
#2546()
[
Smalltalk
]
Rating1/1=1.00
| in delimiters candidates | in := 'aaa abc-hidden.png>hoge-big.jpeg ---foo-hidden-small.gif|^_^a.bmp --hiddena-hoge.png<=not hidden~~ --small.jpg<=not small(^_^) normal-small-big.hoge'. delimiters := in asSet reject: [:each | each isLetter or: ['-.' includes: each]]. candidates := (in findTokens: delimiters) reject: [:each | each = each sansPeriodSuffix]. World findATranscript: nil. candidates do: [:cand | | strm next ext size hidden | strm := (cand findTokens: '-.') reversed readStream. ext := strm next. next := strm next. (strm peek notNil and: [#(small big) includes: next]) ifTrue: [size := next. next := strm next] ifFalse: [size := 'normal']. (hidden := strm peek notNil and: [next = #hidden]) ifTrue: [next := strm next]. Transcript cr; show: {#name->next. #ext->ext. #size->size. #hidden->hidden}]Rating1/1=1.00-0+
[ reply ]