Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Counting occurences of substring in string
proc string_occurrences {needleString haystackString} { regsub -all $needleString $haystackString {} stripped expr {([string length $haystackString] - [string length $stripped]) / [string length $needleString]} } set haystack "foo foo bar" set needle "foo" puts [string_occurrences $needle $haystack]
run
|
edit
|
history
|
help
0
Santosh bin mul eo
procedures.tcl
Perfect neg float bin multiplier
Trail
Perfect bin mul eo float
wewew
Add Dec2bin
mysrc.tcl
zz
Huffman code size