How to print string in the Sui Move language

Ly Channa
Mar 4, 2023

--

In Move, there is no primitive type for string, however, there is a package to handle this. Let’s see it in action

module hello_world::debugger {

#[test]
public fun test_print_types() {
let vect: vector<u8> = b"Hola mundo";
let str: std::string::String = std::string::utf8(vect);

std::debug::print(&vect); // [debug] 0x486f6c61206d756e646f
std::debug::print(&str); // [debug] "Hola mundo"
}
}

--

--

Ly Channa

Highly skilled: REST API, OAuth2, OpenIDConnect, SSO, TDD, RubyOnRails, CI/CD, Infrastruct as Code, AWS.