1) I want to display the number of characters in the word
Eg: If the word is Choose then output should be C-1,h-1,o-2,s-1,e-1.
Can anyone help with complete code or is there any function? Thanks
Discussion posts and replies are publicly visible
a!localVariables( local!word: "choose", local!split: a!forEach( enumerate(len(local!word)), charat(local!word,fv!index) ), local!letterCount: a!forEach( local!split, { character: fv!item, count: length(wherecontains(fv!item,local!split)) } ), union(local!letterCount,local!letterCount) )
There may be a more efficient way to do it but this will work
You could also do the split by using "code()" which converts any string into an array of char codes. So, char(code(local!word)) would result in the array {"c", "h"... [etc]}
Yes, code() is pretttty handy for these type of expressions. 1 ms run time with:
a!localVariables( local!word: code("Choose"), a!forEach( items: union(local!word,local!word), expression: { concat(char(fv!item),"-",count(wherecontains(fv!item,local!word))) } ) )
Thanks a lot..
Thanks for helping..
Thanks Mike