Skip to content

Instantly share code, notes, and snippets.

@philippeback
Created December 13, 2018 21:53
Show Gist options
  • Select an option

  • Save philippeback/a725885d2cadfef9f55189a42012bfed to your computer and use it in GitHub Desktop.

Select an option

Save philippeback/a725885d2cadfef9f55189a42012bfed to your computer and use it in GitHub Desktop.

Revisions

  1. philippeback created this gist Dec 13, 2018.
    17 changes: 17 additions & 0 deletions PharoAndStrings.st
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    words := #('Peek' 'Geek' 'Coke' 'Poke' 'Meaning' 'Zapping' 'Delta' 'force' 'GEEK' 'CoKE' 'ORCa').
    forbiddenWords := #('ok' 'eek' 'orc').

    words
    select: [ :word |
    (forbiddenWords
    inject: 0
    into: [ :sum :forbidden |
    sum + (word
    findString: forbidden
    startingAt: 1
    caseSensitive: false ) ] ) = 0 ].

    words := #('Pic' 'Poc' 'Pac' 'Puc').
    forbidden := #('Poc' 'Puc').

    words reject: [ :w | forbidden includes: w ] "#('Pic' 'Pac')"