WIP vcard 3.0 implementation.
This commit is contained in:
@ -1,7 +0,0 @@
|
||||
# This is just an example to get you started. A typical library package
|
||||
# exports the main API in this file. Note that you cannot rename this file
|
||||
# but you can remove it if you wish.
|
||||
|
||||
proc add*(x, y: int): int =
|
||||
## Adds two files together.
|
||||
return x + y
|
20
src/vcard/private/util.nim
Normal file
20
src/vcard/private/util.nim
Normal 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
|
1248
src/vcard3.nim
Normal file
1248
src/vcard3.nim
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user