Skip to content

Commit 3194f9c

Browse files
committed
Merge branch 'master' of github.com:Janiczek/advent-of-code
2 parents be4eea5 + ec03d0a commit 3194f9c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/extra.gleam

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import gleam/int
33
import gleam/list
44
import gleam/option
55
import gleam/otp/task
6+
import gleam/string
67

78
/// Needs the operation to be associative and there to be a zero (monoid).
89
/// Uses parallelism under the hood.
@@ -54,3 +55,11 @@ pub fn yolo_int(x: String) -> Int {
5455
let assert Ok(n) = int.parse(x)
5556
n
5657
}
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

Comments
 (0)