Thu. Apr 18th, 2024
let stripped = "FREMP my string" // my string
let indexOf = stripped.index(stripped.startIndex,offsetBy:5)
let sub = stripped[..<indexOf] //left cut -> output: "my string"
print("sub")

//sub is of type substring - to make it a string again just type:
let stringAgain = String(sub)

By rams

Leave a Reply

Your email address will not be published. Required fields are marked *