I need to count the number of occurrences of a character in a string.
For example, suppose my string contains:
var mainStr = \"str1,str2,str3,str4\";
My solution with ramda js:
const testString = 'somestringtotest' const countLetters = R.compose( R.map(R.length), R.groupBy(R.identity), R.split('') ) countLetters(testString)
Link to REPL.