Skip to content

Instantly share code, notes, and snippets.

@lmariscal lmariscal/owo.nim
Last active Jun 28, 2019

Embed
What would you like to do?
[owo.nim] OwO text convewtew fow Nyim
import strutils, random
proc lastReplace(s, sub, by: string): string =
let li = s.rsplit(sub, 1)
li.join(by)
proc toOwO*(s: string): string =
let smileys = [";;w;;", "^w^", ">w<", "UwU", "(・`ω´・)", "(´・ω・`)"]
result = s
result = result.replace('L', 'W').replace('l', 'w')
result = result.replace('W', 'W').replace('r', 'w')
result = result.lastReplace(".", ". " & smileys.sample)
result = result.lastReplace("!", "! " & smileys.sample)
result = result.lastReplace("?", "? owo")
for v in ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']:
if result.contains("n" & v):
result = result.replace("n" & v, "ny" & v)
if result.contains("N" & v):
result = result.replace("N" & v, "Ny" & v)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.