summary refs log tree commit diff stats
path: root/lib/system.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2011-05-14 01:13:44 +0200
committerAraq <rumpf_a@web.de>2011-05-14 01:13:44 +0200
commit3e9dcc8be5d1286e3647e8f665f456966aa02437 (patch)
tree8bc3b42f28feba6f93c0bd3c386dcb82eabff484 /lib/system.nim
parent32241aa9fe1a22f388124a6e5db8fb0517f01789 (diff)
downloadNim-3e9dcc8be5d1286e3647e8f665f456966aa02437.tar.gz
deprecated system.copy: use system.substr instead
Diffstat (limited to 'lib/system.nim')
-rwxr-xr-xlib/system.nim15
1 files changed, 13 insertions, 2 deletions
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.