There was an error while loading. Please reload this page.
2 parents be4eea5 + ec03d0a commit 3194f9cCopy full SHA for 3194f9c
src/extra.gleam
@@ -3,6 +3,7 @@ import gleam/int
3
import gleam/list
4
import gleam/option
5
import gleam/otp/task
6
+import gleam/string
7
8
/// Needs the operation to be associative and there to be a zero (monoid).
9
/// Uses parallelism under the hood.
@@ -54,3 +55,11 @@ pub fn yolo_int(x: String) -> Int {
54
55
let assert Ok(n) = int.parse(x)
56
n
57
}
58
+
59
+/// strip_left("Hello World", "Hello ") -> "World"
60
+pub fn strip_left(from input: String, remove prefix: String) -> String {
61
+ case string.starts_with(input, prefix) {
62
+ True -> input |> string.drop_start(string.length(prefix))
63
+ False -> input
64
+ }
65
+}
0 commit comments