Skip to content

Instantly share code, notes, and snippets.

@Deleplace
Created March 25, 2022 08:26
Show Gist options
  • Save Deleplace/f981bf426622743e5ab9786a3807abb8 to your computer and use it in GitHub Desktop.
Save Deleplace/f981bf426622743e5ab9786a3807abb8 to your computer and use it in GitHub Desktop.
Trim prefix
void main() {
var s = "café-society";
var p = "café";
var t = s.startsWith(p) ? s.substring(p.length, s.length) : s;
print(t);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment