Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUST

String to int in Rust

let string = String::from("120");
let number: i32 = string
	.trim()
    .parse()
    .expect("This string cannot be converted to a number");

println!("{}", number + 10) // prints 130
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #String #int #Rust
ADD COMMENT
Topic
Name
2+4 =