Add tags

Add tags to the following comment
Squeak Smalltalk で。
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
| ls list |

ls := [:pathList :pathTo |
    | start stream results path |
    start := pathTo size + 1.
    stream := pathList readStream.
    results := OrderedCollection new.
    [(path := stream next) notNil] whileTrue: [
        (path beginsWith: pathTo) ifTrue: [
            | end |
            end := path indexOf: $/ startingAt: start.
            end isZero ifTrue: [end := path size].
            results add: (path copyFrom: start to: end)]].
    results asArray].

list := #('aaa/bbb' 'aaa/ccc' 'aaa/ddd/eee' 'bbb/ddd/eee').

ls value: list value: 'aaa/'.
   "=> #('bbb' 'ccc' 'ddd/') "
ls value: list value: 'aaa/ddd/'.
   "=> #('eee') "

Add tags

The input will be splited to tags with space.

Index

Feed

Other

Link

Pathtraq

loading...