[squeak-dev] given String 'Foo <nowiki>Bar</nowiki> Baz' yield String 'Foo Baz'
Javier Diaz-Reinoso
javier_diaz_r at mac.com
Fri Dec 25 19:14:10 UTC 2020
> On 25 Dec 2020, at 12:28, gettimothy via Squeak-dev <squeak-dev at lists.squeakfoundation.org> wrote:
>
> 'Foo <nowiki>Bar</nowiki> Baz' removeAllBetween:'<nowiki>' and: '</nowiki>'.
a := 'Foo <nowiki>Bar</nowiki> Baz'.
s:= Scanner new.
toks := s typedScanTokens: a.
sel := ''.
level := 0.
toks do: [:t|
t caseOf: {
[#<] -> [level:=1].
[#</] -> [level:=2].
[#>] -> [level =2 ifTrue:[sel:=sel, ' '. level:=0]].
}
otherwise: [
level = 0 ifTrue:[sel := sel, t]
].
].
sel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20201225/83a241f5/attachment.html>
More information about the Squeak-dev
mailing list
|