Replaced deprecated repeatStr() with repeat().
This commit is contained in:
parent
58186f6c1d
commit
b902ea887b
7 changed files with 14 additions and 14 deletions
|
|
@ -949,7 +949,7 @@ proc genEcho(p: BProc, n: PNode) =
|
||||||
initLocExpr(p, n.sons[i], a)
|
initLocExpr(p, n.sons[i], a)
|
||||||
appf(args, ", $1? ($1)->data:\"nil\"", [rdLoc(a)])
|
appf(args, ", $1? ($1)->data:\"nil\"", [rdLoc(a)])
|
||||||
linefmt(p, cpsStmts, "printf($1$2);$n",
|
linefmt(p, cpsStmts, "printf($1$2);$n",
|
||||||
makeCString(repeatStr(n.len, "%s") & tnl), args)
|
makeCString(repeat("%s", n.len) & tnl), args)
|
||||||
|
|
||||||
proc gcUsage(n: PNode) =
|
proc gcUsage(n: PNode) =
|
||||||
if gSelectedGC == gcNone: message(n.info, warnGcMem, n.renderTree)
|
if gSelectedGC == gcNone: message(n.info, warnGcMem, n.renderTree)
|
||||||
|
|
|
||||||
|
|
@ -461,9 +461,9 @@ proc indentToLevel(level: var int, newLevel: int): string =
|
||||||
if level == newLevel:
|
if level == newLevel:
|
||||||
return
|
return
|
||||||
if newLevel > level:
|
if newLevel > level:
|
||||||
result = repeatStr(newLevel - level, "<ul>")
|
result = repeat("<ul>", newLevel - level)
|
||||||
else:
|
else:
|
||||||
result = repeatStr(level - newLevel, "</ul>")
|
result = repeat("</ul>", level - newLevel)
|
||||||
level = newLevel
|
level = newLevel
|
||||||
|
|
||||||
proc generateDocumentationTOC(entries: seq[TIndexEntry]): string =
|
proc generateDocumentationTOC(entries: seq[TIndexEntry]): string =
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ when isMainModule:
|
||||||
discard """block:
|
discard """block:
|
||||||
var
|
var
|
||||||
TestFile: FileChallengePair
|
TestFile: FileChallengePair
|
||||||
contents = repeatStr(2, "abcdefghijklmnopqrstuvwxyz")
|
contents = repeat("abcdefghijklmnopqrstuvwxyz", 2)
|
||||||
testFile.challenge = newScFileChallenge("foobar.test", FZoneCfg, contents.len.int32)
|
testFile.challenge = newScFileChallenge("foobar.test", FZoneCfg, contents.len.int32)
|
||||||
testFile.file = checksumStr(contents)
|
testFile.file = checksumStr(contents)
|
||||||
myAssets.add testFile"""
|
myAssets.add testFile"""
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,9 @@ when isMainModule:
|
||||||
var res = t.map(proc(z: int): int = result = z * 10)
|
var res = t.map(proc(z: int): int = result = z * 10)
|
||||||
dumpSeq res
|
dumpSeq res
|
||||||
|
|
||||||
from strutils import toHex, repeatStr
|
from strutils import toHex
|
||||||
var foocakes = t.map(proc(z: int): string =
|
var foocakes = t.map(proc(z: int): string =
|
||||||
result = toHex((z * 23).biggestInt, 4))
|
result = toHex((z * 23).BiggestInt, 4))
|
||||||
dumpSeq foocakes
|
dumpSeq foocakes
|
||||||
|
|
||||||
t.mapInPlace(proc(z: int): int = result = z * 30)
|
t.mapInPlace(proc(z: int): int = result = z * 30)
|
||||||
|
|
|
||||||
|
|
@ -24,17 +24,17 @@ when isMainModule:
|
||||||
import strutils
|
import strutils
|
||||||
var r = compress("Hello")
|
var r = compress("Hello")
|
||||||
echo repr(r)
|
echo repr(r)
|
||||||
var l = "Hello".len
|
var ln = "Hello".len
|
||||||
var rr = uncompress(r, l)
|
var rr = uncompress(r, ln)
|
||||||
echo repr(rr)
|
echo repr(rr)
|
||||||
assert rr == "Hello"
|
assert rr == "Hello"
|
||||||
|
|
||||||
proc `*`(a: string; b: int): string {.inline.} = result = repeatStr(b, a)
|
proc `*`(a: string; b: int): string {.inline.} = result = repeat(a, b)
|
||||||
var s = "yo dude sup bruh homie" * 50
|
var s = "yo dude sup bruh homie" * 50
|
||||||
r = compress(s)
|
r = compress(s)
|
||||||
echo s.len, " -> ", r.len
|
echo s.len, " -> ", r.len
|
||||||
|
|
||||||
l = s.len
|
ln = s.len
|
||||||
rr = uncompress(r, l)
|
rr = uncompress(r, ln)
|
||||||
echo r.len, " -> ", rr.len
|
echo r.len, " -> ", rr.len
|
||||||
assert rr == s
|
assert rr == s
|
||||||
|
|
@ -174,7 +174,7 @@ when isMainModule:
|
||||||
block:
|
block:
|
||||||
var
|
var
|
||||||
TestFile: FileChallengePair
|
TestFile: FileChallengePair
|
||||||
contents = repeatStr(2, "abcdefghijklmnopqrstuvwxyz")
|
contents = repeat("abcdefghijklmnopqrstuvwxyz", 2)
|
||||||
testFile.challenge = newScFileChallenge("foobar.test", FZoneCfg, contents.len.int32)
|
testFile.challenge = newScFileChallenge("foobar.test", FZoneCfg, contents.len.int32)
|
||||||
testFile.file = checksumStr(contents)
|
testFile.file = checksumStr(contents)
|
||||||
myAssets.add testFile
|
myAssets.add testFile
|
||||||
|
|
|
||||||
|
|
@ -99,8 +99,8 @@ macro updated(e: expr): expr {.immediate.} =
|
||||||
proc updatedDate(year, month, day: string): string =
|
proc updatedDate(year, month, day: string): string =
|
||||||
## wrapper around the update macro with easy input.
|
## wrapper around the update macro with easy input.
|
||||||
result = updated("$1-$2-$3T00:00:00Z" % [year,
|
result = updated("$1-$2-$3T00:00:00Z" % [year,
|
||||||
repeatStr(2 - len(month), "0") & month,
|
repeat("0", 2 - len(month)) & month,
|
||||||
repeatStr(2 - len(day), "0") & day])
|
repeat("0", 2 - len(day)) & day])
|
||||||
|
|
||||||
macro entry(e: expr): expr {.immediate.} =
|
macro entry(e: expr): expr {.immediate.} =
|
||||||
## generates the rss xml ``entry`` element.
|
## generates the rss xml ``entry`` element.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue