-
Notifications
You must be signed in to change notification settings - Fork 1
/
char-replaced.fs
35 lines (28 loc) · 806 Bytes
/
char-replaced.fs
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
35
\ galope/char-replaced.fs
\ This file is part of Galope
\ http:https://programandala.net/en.program.galope.html
\ Author: Marcos Cruz (programandala.net), 2014, 2017.
\ ==============================================================
: char-replaced ( ca len c1 c2 -- )
{: to-char from-char :}
bounds ?do
i c@ from-char = if to-char i c! then
loop ;
\ doc{
\
\ char-replaced ( ca len c1 c2 -- )
\
\ Replaces all ocurrences of character _c2_ in string _ca len_
\ with character _c1_.
\
\ See: `instr`, `instr?`, `char-count`.
\
\ }doc
\ ==============================================================
\ Change log
\ 2014-05-10 Written.
\
\ 2017-08-17: Update change log layout. Update header. Update source
\ style.
\
\ 2017-10-26: Improve documentation. Update locals notation.