Switch to edit mode.
Name(s): properly_capitalize1: {string, ?non_capitalized = {"to", "for", "of", "a", "with"}} = args
2: words = $su:words(string)
3: out = {}
4: for x in [1..length(words)]
5: if (x != 1 && words[x] in non_capitalized)
6: out = {@out, words[x]}
7: else
8: out = {@out, $su:capitalize(words[x])}
9: endif
10: endfor
11: return $su:from_list(out, " ")