From 3e9dcc8be5d1286e3647e8f665f456966aa02437 Mon Sep 17 00:00:00 2001 From: Araq Date: Sat, 14 May 2011 01:13:44 +0200 Subject: deprecated system.copy: use system.substr instead --- lib/system.nim | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'lib/system.nim') diff --git a/lib/system.nim b/lib/system.nim index a18412790..21da9d6ff 100755 --- a/lib/system.nim +++ b/lib/system.nim @@ -909,8 +909,19 @@ proc addQuitProc*(QuitProc: proc {.noconv.}) {.importc: "atexit", nodecl.} # not be called explicitly! The user may decide to do this manually though. proc copy*(s: string, first = 0): string {. - magic: "CopyStr", importc: "copyStr", noSideEffect.} + magic: "CopyStr", importc: "copyStr", noSideEffect, deprecated.} proc copy*(s: string, first, last: int): string {. + magic: "CopyStrLast", importc: "copyStrLast", noSideEffect, + deprecated.} + ## copies a slice of `s` into a new string and returns this new + ## string. The bounds `first` and `last` denote the indices of + ## the first and last characters that shall be copied. If ``last`` + ## is omitted, it is treated as ``high(s)``. + ## **Deprecated since version 0.8.12**: Use ``substr`` instead. + +proc substr*(s: string, first = 0): string {. + magic: "CopyStr", importc: "copyStr", noSideEffect.} +proc substr*(s: string, first, last: int): string {. magic: "CopyStrLast", importc: "copyStrLast", noSideEffect.} ## copies a slice of `s` into a new string and returns this new ## string. The bounds `first` and `last` denote the indices of @@ -1783,7 +1794,7 @@ template `-|`(b, s: expr): expr = proc `[]`*(s: string, x: TSlice[int]): string {.inline.} = ## slice operation for strings. Negative indexes are supported. - result = s.copy(x.a-|s, x.b-|s) + result = s.substr(x.a-|s, x.b-|s) proc `[]=`*(s: var string, x: TSlice[int], b: string) = ## slice assignment for strings. Negative indexes are supported. -- cgit 1.4.1-2-gfad0