# How to operate String

**URL:** <https://forum.fuel.network/t/how-to-operate-string/5800>\
**Category:** General\
**Created:** [June 14, 2024, 6:35am UTC](https://forum.fuel.network/t/how-to-operate-string/5800 "2024-06-14T06:35:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![william](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/william/32/3432_2.png) [@william](https://forum.fuel.network/u/william)\
**Post date:** [June 14, 2024, 6:35am UTC](https://forum.fuel.network/t/how-to-operate-string/5800/1 "2024-06-14T06:35:36Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![naz3eh](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/naz3eh/32/2025_2.png) [@naz3eh](https://forum.fuel.network/u/naz3eh)\
**Post date:** [June 14, 2024, 4:27pm UTC](https://forum.fuel.network/t/how-to-operate-string/5800/2 "2024-06-14T16:27:48Z")

</div>

Hey @william, is this what you are looking for [How to concatenate strings in Sway?](https://forum.fuel.network/t/how-to-concatenate-strings-in-sway/4348)?

---

<div class="post-metadata">

**Author:** ![william](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/william/32/3432_2.png) [@william](https://forum.fuel.network/u/william)\
**Post date:** [June 14, 2024, 11:43pm UTC](https://forum.fuel.network/t/how-to-operate-string/5800/3 "2024-06-14T23:43:14Z")

</div>

Thank You, It can work

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex022/uploads/fuel/original/2X/5/57d5a345cc15a64b636e0d56e042857f8a0e80b1.png) [@system](https://forum.fuel.network/u/system)\
**Post date:** [July 5, 2024, 7:43pm UTC](https://forum.fuel.network/t/how-to-operate-string/5800/4 "2024-07-05T19:43:18Z")

</div>

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