Skip to content

How to push string array into vector ? #112

Discussion options

You must be logged in to vote

How to append a vector onto another vector

So what you're trying to accomplish is like most languages where you want to do the following:

vector[1,2,3] + vector[4,5,6] = vector[1,2,3,4,5,6]

You can do this with the vector::append() See https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/framework/move-stdlib/sources/vector.move#L100-L104

How do you apply it to your example

struct UserWallets has key {
    walletAddress: vector<string::String>,
}

public entry fun registerWallets(caller: &signer, walletAddress: vector<string::String>) acquires UserWallets {
    let caller_address = signer::address_of(caller);
    if (!exists<UserWallets>(caller_address)) {
        move_to(caller, 

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Ghonghito
Comment options

Answer selected by Ghonghito
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
move Questions related to the Move Language
2 participants