-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathchar-count.fs
More file actions
34 lines (27 loc) · 751 Bytes
/
char-count.fs
File metadata and controls
34 lines (27 loc) · 751 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
\ galope/char-count.fs
\ This file is part of Galope
\ http://programandala.net/en.program.galope.html
\ Author: Marcos Cruz (programandala.net), 2012, 2017.
\ ==============================================================
: char-count ( ca len c -- n )
0 2swap bounds ?do over i c@ = abs + loop nip ;
\ doc{
\
\ char-count ( ca len c -- n )
\
\ Count the number of occurrences of character _c_ in string _ca
\ len_.
\
\ See: `instr`, `instr?`, `char-replaced`.
\
\ }doc
\ ==============================================================
\ Change log
\ 2013-12-06: First version.
\
\ 2015-10-13: Renamed.
\
\ 2017-08-17: Update change log layout. Update header. Update source
\ style.
\
\ 2017-10-26: Improve documentation.