How to operate String

How to operate String, such as do ‘add’, storage
my simple code is below:

contract;

abi StoreString {
#[storage(read)]
fn name() → String;
}

use std::string::String;

configurable {
word1: str[8] = __to_str_array(“MyAsset1”),
word2: str[7] = __to_str_array(“MyAsset”),
}

impl StoreString for Contract {
#[storage(read)]
fn name() → String {
String::from_ascii_str(from_str_array(word1))
}
}

if I want to add word1 and word2 then return, what should I do?
If I want to storage String, then return, what should I do?

Hey @william, is this what you are looking for How to concatenate strings in Sway??

Thank You, It can work

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.