-
Notifications
You must be signed in to change notification settings - Fork 0
/
STRCOUNT.PROC
20 lines (18 loc) · 1.6 KB
/
STRCOUNT.PROC
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* --------------------------------------------------------------- */
/* StrCount: Procedure; */
/* Returns the number of needles found in the haystack. */
/* */
/* Author: "Hughes, Jim - OIT" <[email protected]> */
/* --------------------------------------------------------------- */
Arg needle,haystack;
/*
Where: needle is the string value to find,
haystack is the string value to search
(using a case insensitive search).
*/
haystack = x'00'||haystack||x'00';
Do count = 0 Until haystack = ""
Parse Var haystack . (needle) haystack;
End
Return count;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */