Init submit the testing Code
This commit is contained in:
parent
d8df72fb1e
commit
6643772ab5
|
@ -0,0 +1,23 @@
|
|||
; https://www.isharkfly.com/t/mumps-character-counting/15224
|
||||
SET array("a")="adsakljasdira"
|
||||
SET array("D")="DDD"
|
||||
DO countCharsInAry(.array, .countByChar)
|
||||
set name=""
|
||||
f s name=$O(countByChar(name)) q:name="" w !,countByChar(name)
|
||||
QUIT
|
||||
countCharsInAry(ary,countByChar)
|
||||
SET name=""
|
||||
FOR SET name=$O(ary(name)) QUIT:name="" DO SET countByChar(name)=$$getCount(ary(name),name)
|
||||
QUIT
|
||||
getCount(str,subStr)
|
||||
SET count=0
|
||||
SET position=0
|
||||
|
||||
FOR {
|
||||
SET position=$FIND(str, subStr, position)
|
||||
QUIT:position=0
|
||||
SET count=count+1
|
||||
SET position=position
|
||||
}
|
||||
|
||||
QUIT count
|
Loading…
Reference in New Issue