Count occurrences of a substring: Difference between revisions

Content added Content deleted
(Add 8086 assembly)
(Add APL)
Line 308: Line 308:
Count String : 5
Count String : 5
</pre>
</pre>

=={{header|APL}}==
{{works with|Dyalog APL}}

<lang apl>csubs←{0=x←⊃⍸⍺⍷⍵:0 ⋄ 1+⍺∇(¯1+x+⍴⍺)↓⍵}</lang>

{{out}}

<pre> 'th' 'abab' 'dog' csubs¨ 'the three truths' 'ababababab' 'cat'
3 2 0</pre>


=={{header|AppleScript}}==
=={{header|AppleScript}}==