Here's a function that takes a string as an input and returns a struct with the frequency of each letter in the input string.
main.m498 chars18 lines
This code uses regex to remove non-letter characters from the input string, converts everything to lowercase, and then iterates through each letter in the resulting string to count the frequency of occurrences. It stores the result in a struct with field names corresponding to each letter, and the field values representing the frequency counts.
gistlibby LogSnag