add replace

This commit is contained in:
2026-07-11 17:39:17 +02:00
parent 173b625c20
commit 0cde1d9c3c
3 changed files with 198 additions and 3 deletions
+11 -3
View File
@@ -1,7 +1,15 @@
fn replace(text string, start int, len int, repl string) string {
return text[..start] + repl + text[start + len..]
}
fn parse(lines []string) string {
mut output := ''
for _, line in lines {
output += line + '\n'
mut output := '<p>'
for line in lines {
if idx := line.index('2') {
output += replace(line, idx, 1, 'foferk') + '<br>\n'
}
output += line + '<br>\n'
}
output += '</p>'
return output
}