How do we preallocate string as element of array as this is..

2022-03-24 Thread xigoi
import std/sequtils let bar = newSeqWith(99, [newStringOfCap(999), newStringOfCap(999)]) Run

How do we preallocate string as element of array as this is..

2022-03-23 Thread sls1005
var bar = newSeqOfCap[array[2, string]](99) for _ in 1 .. 99: bar.add [newStringOfCap(999), newStringOfCap(999)] Run

How do we preallocate string as element of array as this is..

2022-03-23 Thread mardiyah
var bar: array[2, string] might be meant: var bar : seq[ array[2, string] ] ? ..then how

How do we preallocate string as element of array as this is..

2022-03-23 Thread demotomohiro
var bar: array[2, string] for i in bar.low .. bar.high: bar[i] = newStringOfCap(999) Run or var bar = [newStringOfCap(999), newStringOfCap(999)] Run

How do we preallocate string as element of array as this is..

2022-03-23 Thread auxym
use `newSeqWith` fom the `std/sequtils` package

How do we preallocate string as element of array as this is..

2022-03-23 Thread mardiyah
How do we preallocate string as element of array as this is for plainly a string: `foo = newStringOfCap( 999)` but needed it as inner string of `bar = newSeqOfCap[ array[ 2, string] ](99)` Thanks much in advance for helping