When I run this script:
fn main() {
// \033[0;31m <- Red
// \033[0m <- No Color
println!("\033[0;31mSO\033[0m")
}
I expect to get
SO #in red letters
However, I get:
33[0;31mSO33[0m
When I ran similar script in Go or Python, I get the expected output. What is going on? What am I missing? How do fix this?
I am using:
$ rustc --version
rustc 1.3.0 (9a92aaf19 2015-09-15)
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.3 LTS
Release: 14.04
Codename: trusty
Rust 1.3.0 does not seem to support octal escape strings such as \033
. Instead, you can use hexadecimal escape strings like \x1b
.
fn main(){
println!("\x1b[0;31mSO\x1b[0m")
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments