Posted By

berndschiffer on 12/02/09


Tagged

textmate search groovy consontant


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

javadude


Finding the Longest Consonant Cluster


 / Published in: Groovy
 

  1. def words = [
  2. berndschiffer: 'Angstschweiss', // ß -> ss
  3. mittie: 'Herbstschnee',
  4. mittie: 'rontgst', // ö -> o
  5. mittie: 'Durststrecke',
  6. mittie: 'Kunstspringen',
  7. mittie: 'Borschtschschmand',
  8. ipreuss: 'Borschtschschussel', // ü -> u
  9. ]
  10. println words.collect{ user, word ->
  11. def cluster = word.toLowerCase().split(/[aeiou]/).sort{ it.size() }.toList().last()
  12. [cluster] << "@$user found the longest consonant cluster '$cluster' in the word '$word'."
  13. }.sort{ it.first().size() }.last().last()

Report this snippet  

You need to login to post a comment.