Jump to content

Selectively replace multiple instances of a character within a string: Difference between revisions

Added Easylang
(Added Ada version)
(Added Easylang)
 
Line 316:
</pre>
 
 
=={{header|EasyLang}}==
<syntaxhighlight>
rs$[] = [ "a" "b" "r" ]
rc[][] = [ [ 1 2 4 5 ] [ 1 ] [ 2 ] ]
rd$[][] = [ [ "A" "B" "C" "D" ] [ "E" ] [ "F" ] ]
s$ = "abracadabra"
#
len cnt[] len rs$[]
for c$ in strchars s$
for i to len rs$[]
if c$ = rs$[i]
cnt[i] += 1
for j to len rc[i][]
if rc[i][j] = cnt[i]
c$ = rd$[i][j]
.
.
.
.
r$ &= c$
.
print r$
</syntaxhighlight>
{{out}}
<pre>
AErBcadCbFD
</pre>
 
=={{header|EMal}}==
2,083

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.