18 lines
883 B
Nim
18 lines
883 B
Nim
# cstring handling utilities for performance
|
|
|
|
proc split*(s, sep: cstring): seq[cstring] {.importcpp, nodecl.}
|
|
|
|
proc split*(s, sep: cstring; max: int): seq[cstring] {.importcpp, nodecl.}
|
|
|
|
proc startsWith*(a, b: cstring): bool {.importcpp: "startsWith", nodecl.}
|
|
proc contains*(a, b: cstring): bool {.importcpp: "(#.indexOf(#)>=0)", nodecl.}
|
|
proc substr*(s: cstring; start: int): cstring {.importcpp: "substr", nodecl.}
|
|
proc substr*(s: cstring; start, length: int): cstring {.importcpp: "substr", nodecl.}
|
|
|
|
#proc len*(s: cstring): int {.importcpp: "#.length", nodecl.}
|
|
proc `&`*(a, b: cstring): cstring {.importcpp: "(# + #)", nodecl.}
|
|
proc toCstr*(s: int): cstring {.importcpp: "((#)+'')", nodecl.}
|
|
proc `&`*(s: int): cstring {.importcpp: "((#)+'')", nodecl.}
|
|
proc `&`*(s: bool): cstring {.importcpp: "((#)+'')", nodecl.}
|
|
|
|
proc `&`*(s: cstring): cstring {.importcpp: "(#)", nodecl.}
|