Functions and methods

[TOC]

1. std::String

1.1 Create a String from a string literal(字符串字面值)

  • String::from()

  • str.to_string()

  • let variable: String = str.into()

1.2 从utf-8 btyes创建String

  • String::from_utf8(bytes).unwarp()

  • string.into_bytes(),将一个String转化为bytes

1.3 向一个可变String添加字符

  • push_str(str)

Last updated