WIP vcard 3.0 implementation.

This commit is contained in:
2023-03-26 20:45:52 -05:00
parent 3a7808668a
commit d6d8e1d654
8 changed files with 1942 additions and 10 deletions

View File

@ -0,0 +1,20 @@
import strutils
func foldContentLine*(s: string): string =
result = ""
var rem = s
while rem.len > 75: # TODO: unicode multi-byte safe?
result &= rem[0..<75] & "\r\n "
rem = rem[75..^1]
result &= rem
func unfoldContentLine*(s: string): string =
return s.multiReplace([("\r\n ", "")])
template indexOfIt*(s, pred: untyped): int =
var result = -1
for idx, it {.inject.} in pairs(s):
if pred:
result = idx
break
result