Number of occurences for a string pattern
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
Number of occurences for a string pattern
Is there a function to count number of occurrences of a string pattern in string list? Before writing a function, I want to know if there is out-of-the-box functionality to compute number of occurrences of a string pattern in a string list? Thanks,
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13584
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Number of occurences for a string pattern
Hi,
here is a (case-sensitive) workaround in one line.
Let %s1 denote the shorter string occuring zero or more times in the longer string %s2. The code
Best, mamo
here is a (case-sensitive) workaround in one line.
Let %s1 denote the shorter string occuring zero or more times in the longer string %s2. The code
Code: Select all
(@strlen(%s2)-@strlen(@replace(%s2,%s1,"")))/@strlen(%s1)
Who is online
Users browsing this forum: No registered users and 2 guests
