How count occurence of a character in a string?

stefdelecstefdelec Member, PRO Posts: 146

Hi everyone,

How can I count occurence of a character in a string?

I'd like to know many a,e,i,o,u,y there is in a string. How could I do that?

Tks,

Stéphane.

Comments

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273

    Use a loop to loop through the word. With each cycle, use the substring function to look at each individual letter in the word. Use a rule to evaluate if it's a vowel. If it is, add to an attribute.

  • stefdelecstefdelec Member, PRO Posts: 146
    edited August 2015

    That was my guess too... Thanks. Thought there would be an easier way to do it.

  • ArmellineArmelline Member, PRO Posts: 5,421

    Are you wanting to find out how many vowels are in a string, or how many of a particular letter are in a string?

  • stefdelecstefdelec Member, PRO Posts: 146

    In this purpose, how many vowels (except Y)

  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803

    Here is a project to do pattern count in a text. It is case sensitive.

  • ArmellineArmelline Member, PRO Posts: 5,421

    Here's a bit of both.

Sign In or Register to comment.