nim-lang / Nim

Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).
https://nim-lang.org
Other
16.64k stars 1.47k forks source link

`add(var string, openArray[char])` overload #24367

Closed metagn closed 1 month ago

metagn commented 1 month ago

The only overloads for add to string are for char, string and cstring. An overload that allows adding an openArray[char] does not exist, for things like cstrings with a specific length, sections of seq[char], ptr UncheckedArray[char] etc. Writing it manually via for c in openarr: str.add(c) would be much less efficient than a specialized overload.

Same goes for insert.

haoyu234 commented 1 month ago

proc add*(x: var string, y: openArray[char]) =

is in strbasics.nim