SplitScript reference / String / indexOf
String.indexOf
Method
String.indexOf(substring: String) -> u32?
Finds the first exact substring and returns its UTF-8 byte offset.
Returns None when the substring is absent. An empty substring is found at byte offset zero. Searching is allocation-free and case-sensitive.
Parameters
substring: The substring to search for.
Effects: pure
Runtime behavior: available everywhere; synchronous
Examples
Find a separator in an ASCII scene identifier
let separator = "chapter_room".indexOf("_") else return