Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Janiczek/advent-of-code
Browse files Browse the repository at this point in the history
  • Loading branch information
Janiczek committed Dec 4, 2024
2 parents be4eea5 + ec03d0a commit 3194f9c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/extra.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import gleam/int
import gleam/list
import gleam/option
import gleam/otp/task
import gleam/string

/// Needs the operation to be associative and there to be a zero (monoid).
/// Uses parallelism under the hood.
Expand Down Expand Up @@ -54,3 +55,11 @@ pub fn yolo_int(x: String) -> Int {
let assert Ok(n) = int.parse(x)
n
}

/// strip_left("Hello World", "Hello ") -> "World"
pub fn strip_left(from input: String, remove prefix: String) -> String {
case string.starts_with(input, prefix) {
True -> input |> string.drop_start(string.length(prefix))
False -> input
}
}

0 comments on commit 3194f9c

Please sign in to comment.