Select Page

How to Get an Absolute Value in Rust

We can calculate the absolute value of a number using the abs() method. We have to specify the numeric type before we call the abs method, for example, if we want a 32-bit signed integer we need to put i32 after the number. This tutorial will go through how to...

How to Read and Write to File in Rust

This tutorial will go through how to read and write to a file for Rust version 1.26+ and Rust version 1.0. Table of contentsRead a File to String in Rust 1.26+Read a File to String in Rust 1.0Read a File to Vec<u8> in Rust 1.26+Read a File to Vec<u8> in Rust...

How to Convert String to Integer and Float in Rust

This tutorial will go through how to convert a string to an integer/float and vice versa. Table of contentsNumbers in RustIntegersFloatsRust Convert String to IntegerRust Convert Integer to StringRust Convert String to FloatRust Convert Float to StringRust Convert...

How to Split a String in Rust

This tutorial will go through how to split a string in Rust. Table of contentsSplit String in Rust Using split()Split String in Rust Using split_whitespace()Split String in Rust Using lines()Split String in Rust Using RegexSplit String on Multiple Delimiters in...

How to Concatenate Strings in Rust

This tutorial will go through concatenating strings and describe the two types of strings in Rust. Table of contentsStrings in RustConcatenate Strings in Rust using push_str()Concatenate Strings in Rust using format!()Concatenate Strings in Rust using +...