cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
psundar6
Level III

Count number of occurrences of a character in a string

Hi,

I am trying to count the number of occurrences of a character in a string. How do I achieve that using JSL?

For eg:

Number of occurrences of letter 'A' in the below strings

APPLE -> 1

PEARS -> 1

BANANA -> 2

 

1 REPLY 1
psundar6
Level III

Re: Count number of occurrences of a character in a string

Below formula actually works perfect.

 

Length( :Name( "Col1" ) ) - Length( Substitute( :Name( "Col1" ), "A", "" ) )

Recommended Articles