Troubles with ranging over a string

never is - it will help others to avoid some pitfalls or adjusting expectations

to mention:

  • this is a three way cascade: Go → Go templates (html/text) → Hugo
    might be that the templating engine already does abstractions here.

  • the docs for range state

    Syntax: range COLLECTION

    the docs state the types for arguments and returns maybe some gaps with ANY, but …
    if one goes to the technical details a Go string is an array…with all the gory details.

  • maybe should have not that brief on range "abc" "" will fail :slight_smile:

  • and maybe range (split "abc" "") is what you called remembered.

  • byte or rune looping seems a little heavy so I showed an alternative.