Author |
Message
|
vairavan |
Posted: Tue Jan 13, 2009 10:05 am Post subject: Counting the number of occurences of a character in a String |
|
|
Apprentice
Joined: 22 Apr 2008 Posts: 42
|
Hi,
Can anybody help me in getting the number of occurences of a character in a String?
For Example:
String s= 'ABCABABABABA';
It should give 6
Any comments will be appreciated... |
|
Back to top |
|
 |
vairavan |
Posted: Tue Jan 13, 2009 1:14 pm Post subject: Counting the number of occurences of a character in a String |
|
|
Apprentice
Joined: 22 Apr 2008 Posts: 42
|
Hi,
Can anybody help me in getting the number of occurences of a character in a String using ESQL?
For Example:
String s= 'ABCABABABABA';
It should give 6
Any comments will be appreciated... |
|
Back to top |
|
 |
madi |
Posted: Tue Jan 13, 2009 1:19 pm Post subject: |
|
|
 Chevalier
Joined: 17 Jan 2006 Posts: 475
|
I don't think there is direct function that can do that within esql. But I may be wrong.
--madi _________________ IBM Certified Solutions Developer - WMB 6.0 |
|
Back to top |
|
 |
kimbert |
Posted: Tue Jan 13, 2009 1:31 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5543 Location: Southampton
|
Why do you want to do that? |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Jan 13, 2009 2:10 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
madi wrote: |
I don't think there is direct function that can do that within esql. But I may be wrong.
--madi |
There's a simple composition of overlay and length. |
|
Back to top |
|
 |
sarathmattam |
Posted: Tue Jan 13, 2009 6:53 pm Post subject: |
|
|
Voyager
Joined: 05 Sep 2008 Posts: 94
|
I think you can use POSITION function to achieve this .. Do it in a loop.. i am not sure whether its the best method .. But it works.. |
|
Back to top |
|
 |
|