Skip to content

Instantly share code, notes, and snippets.

@Deleplace
Created March 25, 2022 08:22
Show Gist options
  • Save Deleplace/d2f00a39998f3c9513aa687e97ac8805 to your computer and use it in GitHub Desktop.
Save Deleplace/d2f00a39998f3c9513aa687e97ac8805 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.replaceFirst(p,"") : s;
print(t);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment