Answers for "get rid of first and last letter in string"

6

python remove first and last character from string

string = string[1:-1]
Posted by: Guest on April-22-2021
0

Remove first and last letter of string

// Remove first and last letter of string

fn main() {
let text = "Hello, world";

// remove last letter
let mut text = text.split_at(text.len() - 1);

// remove first letter
text = text.0.split_at(1);

println!("{}", text.1);
}
Posted by: Guest on October-13-2021

Code answers related to "get rid of first and last letter in string"

Python Answers by Framework

Browse Popular Code Answers by Language