Using a speech engine to highlight words: Difference between revisions
Using a speech engine to highlight words (view source)
Revision as of 14:29, 26 August 2020
, 3 years agoadded Raku programming solution
(added Raku programming solution) |
|||
Line 228:
main()</lang>
=={{header|Raku}}==
{{trans|Go}}
<lang perl6># 20200826 Raku programming solution
my \s = "Actions speak louder than words.";
my \prev = $ = "";
my \prevLen = $ = 0;
my \bs = $ = "";
for s.split(' ', :skip-empty) {
run "/usr/bin/espeak", $_ or die;
bs = "\b" x prevLen if prevLen > 0;
printf "%s%s%s ", bs, prev, $_.uc;
prev = "$_ ";
prevLen = $_.chars + 1
}
printf "%s%s\n", "\b" x prevLen, prev;</lang>
=={{header|REXX}}==
|