SplitScript reference / String / lastIndexOf
String.lastIndexOf
Method
String.lastIndexOf(substring: String) -> u32?
Finds the last exact substring and returns its UTF-8 byte offset.
Returns None when the substring is absent. An empty substring is found at the string's final byte boundary. Searching is allocation-free and case-sensitive.
Parameters
substring: The substring to search for.
Effects: pure
Runtime behavior: available everywhere; synchronous
Examples
Find the final separator in a path
let separator = "/game/bin/game.exe".lastIndexOf("/") else return