You need to sign in to do that
Don't have an account?
Guru 91
How to get number of times sub-string appear in a String?
Hi,
I a string and it has 'AND' sting multiple times how to find a number of times sub-string occurs in a string.
He is my code
String str= AccountName AND AccountPhone;
integer ct=?
I a string and it has 'AND' sting multiple times how to find a number of times sub-string occurs in a string.
He is my code
String str= AccountName AND AccountPhone;
integer ct=?
Use countMatches() method..
String str= 'AccountName AND AccountPhone';
integer ct=str.countMatches('AND')
Hope this will help...
All Answers
Use countMatches() method..
String str= 'AccountName AND AccountPhone';
integer ct=str.countMatches('AND')
Hope this will help...
Returns the number of times the specified substring occurs in the current String.