ModularM
Modular2y ago
1 reply
duck_tape

Creating a string from a DynamicVector Drops the last character in the vector

This example sums up the question:
fn test_stringify() raises:
    var example = DynamicVector[Int8]()
    example.append(ord("e"))
    example.append(ord("x"))

    var container = DynamicVector[Int8]()
    for i in range(len(example)):
        container.append(example[i])
    let stringifed = String(container)
    assert_equal("ex", stringifed)
    # Unhandled exception caught during execution: AssertionError: ex is not equal to e


Is it assuming it's a null terminated string or something?
Was this page helpful?