function that count

-matrix--matrix- Member Posts: 103
Hi guys!
I need of create a function that count the number of specyfic character in a string.
For example: string 'ASSS ' i need to count that in this string there are 3 S.
Do you have some ideas for do this?
Thanks

Comments

  • einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    The following piece of code will...
    1. Delete a given char from your string.
    2. Use the remaining chars of 1. to delete any char except your given char.
    3. Count the number of your given char.
    NoOfChars := STRLEN(DELCHR(YourString,'=',DELCHR(YourString,'=',YourChar)));
    
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • SavatageSavatage Member Posts: 7,142
    how about DELCHR to delete everything except "S"
    then STRLEN to count what remains
    edit : i was too slow :oops:
Sign In or Register to comment.