This language bar is your friend. Select your favorite languages!
Select your favorite languages :
- Or search :
- C
- C++
- C#
- D
- Dart
- Dart
- Fortran
- Go
- Haskell
- JS
- Java
- Java
- Java
- Lua
- PHP
- Pascal
- Perl
- Python
- Python
- Ruby
- Ruby
- Rust
- Rust
- Rust
t = Maybe.fromMaybe s $ List.stripPrefix p s
List.stripPrefix returns Nothing if s does not start with p and returns Just strippedString if it starts with p.
Maybe.fromMaybe makes it so that we return s if the result is Nothing, or the strippedString if the result is
Just strippedString.
Maybe.fromMaybe makes it so that we return s if the result is Nothing, or the strippedString if the result is
Just strippedString.
let t = s.startsWith(p) ? s.substring(p.length) : s;
substring returns a string that starts from given index.
String t = s.replaceFirst("^" + p, "");
This works if p doesn't contain any regexp control characters
programming-idioms.org