Search
 
SCRIPT & CODE EXAMPLE
 

RUST

rust .trim()

fn main() {
  // create some strings
  let string1 = " Welcome to Edpresso    ";
  let string2 = "Educative is the best!     ";
  let string3 = "     Rust is very interesting!";

  // trim the strings
  let trim1 = string1.trim();
  let trim2 = string2.trim();
  let trim3 = string3.trim();

  // print the trims
  println!("The string before trim is '{}' and length is {}", string1, string1.len());
  println!("The string when trimmed is '{}' and length is {}", trim1, trim1.len());

  println!("
The string before trim is '{}' and length is {}", string2, string2.len());
  println!("The string when trimmed is '{}' and length is {}", trim2, trim2.len());

  println!("
The string before trim is '{}' and length is {}", string3, string3.len());
  println!("The string when trimmed is '{}' and length is {}", trim3, trim3.len());

}
Comment

PREVIOUS NEXT
Code Example
Rust :: create empty string rust 
Rust :: hello world latex 
Rust :: rust into string 
Rust :: rust option get value 
Rust :: rust hello world 
Rust :: rust enum to string 
Rust :: enum in rust 
Rust :: rust iterate vector backwards 
Rust :: rust init vec with values 
Rust :: multithreading rust example 
Rust :: rust get char at index 
Rust :: rust undefined size array 
Rust :: armanriazi•rust•error•cannot use the `?` operator in a function that returns `()` 
Rust :: armanriazi•rust•static 
Rust :: armanriazi•rust•error•[E0614]: cannot be dereferenced 
Rust :: rust•armanriazi•loop•listen 
Rust :: initialize empty vec in rust 
Rust :: armanriazi•rust•error•[E0072]: recursive type `List` has infinite size -- src/main.rs:3:1 | 3 | enum List { | ^^^^^^^^^ recursive type has infinite size 
Rust :: armanriazi•rust•trait•where 
Lua :: lua 
Lua :: user input lua 
Lua :: roblox loop all players 
Lua :: roblox lua brick color randomiser 
Lua :: roblox tweenservice 
Lua :: lua indexof 
Lua :: how to split strings into 2 string by space lua 
Lua :: roblox lua how to apply gravity to a object 
Lua :: what is lua programming language 
Lua :: lua table concanation 
Matlab :: matlab count elements in matrix 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =