findTokens: in Pharo versus Dolphin Smalltalk

339 views Asked by At

I want to split a String in Pharo 4. My input is

'a %% b %% c %%% d %% e %% f' 

and I want to get

#('a %% b %% c' 'd %% e %% f')

thus the separator is ' %%% '

In Dolphin 7 it works nice:

'a %% b %% c %%% d %% e %% f' subStrings: ' %%% '
#('a %% b %% c' 'd %% e %% f')

But in Pharo 4 seems to be broken:

'a %% b %% c %%% d %% e %% f' subStrings: ' %%% '
"#('a' 'b' 'c' 'd' 'e' 'f')"

There is a way to get the Dolphin behavior in Pharo?

1

There are 1 answers

1
John Pfersich On BEST ANSWER

Try

'a %% b %% c %%% d %% e %% f' splitOn: ' %%% '

It also works with

'a %% b %% c %%% d %% e %% f %%% g %% h %% i' splitOn: ' %%% '