Skip to content

Commit

Permalink
Remove deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
lpil committed Feb 4, 2025
1 parent 1d327dd commit 9548d28
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 112 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- The deprecated `drop_left`, `drop_right`, `pad_left`, `pad_right`,
`trim_left`, and `trim_right` functions have been removed.
- Fixed a bug that would result in `list.unique` having quadratic runtime.
- Fixed the implementation of `list.key_set` to be tail recursive.
- The `pop` and `pop_map` functions in the `list` module have been deprecated.
Expand Down
112 changes: 0 additions & 112 deletions src/gleam/string.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -222,20 +222,6 @@ fn do_slice(string: String, idx: Int, len: Int) -> String
@external(javascript, "../gleam_stdlib.mjs", "crop_string")
pub fn crop(from string: String, before substring: String) -> String

/// Drops *n* graphemes from the left side of a `String`.
///
/// ## Examples
///
/// ```gleam
/// drop_left(from: "The Lone Gunmen", up_to: 2)
/// // -> "e Lone Gunmen"
/// ```
///
@deprecated("Use `string.drop_start` instead.")
pub fn drop_left(from string: String, up_to num_graphemes: Int) -> String {
drop_start(string, num_graphemes)
}

/// Drops *n* graphemes from the start of a `String`.
///
/// ## Examples
Expand All @@ -256,20 +242,6 @@ pub fn drop_start(from string: String, up_to num_graphemes: Int) -> String {
}
}

/// Drops *n* graphemes from the right side of a `String`.
///
/// ## Examples
///
/// ```gleam
/// drop_right(from: "Cigarette Smoking Man", up_to: 2)
/// // -> "Cigarette Smoking M"
/// ```
///
@deprecated("Use `string.drop_end` instead.")
pub fn drop_right(from string: String, up_to num_graphemes: Int) -> String {
drop_end(string, num_graphemes)
}

/// Drops *n* graphemes from the end of a `String`.
///
/// ## Examples
Expand Down Expand Up @@ -464,34 +436,6 @@ pub fn join(strings: List(String), with separator: String) -> String {
|> concat
}

/// Pads a `String` on the left until it has at least given number of graphemes.
///
/// ## Examples
///
/// ```gleam
/// pad_left("121", to: 5, with: ".")
/// // -> "..121"
/// ```
///
/// ```gleam
/// pad_left("121", to: 3, with: ".")
/// // -> "121"
/// ```
///
/// ```gleam
/// pad_left("121", to: 2, with: ".")
/// // -> "121"
/// ```
///
@deprecated("Use `string.pad_start` instead.")
pub fn pad_left(
string: String,
to desired_length: Int,
with pad_string: String,
) -> String {
pad_start(string, desired_length, pad_string)
}

/// Pads the start of a `String` until it has a given length.
///
/// ## Examples
Expand Down Expand Up @@ -525,34 +469,6 @@ pub fn pad_start(
}
}

/// Pads a `String` on the right until it has a given length.
///
/// ## Examples
///
/// ```gleam
/// pad_right("123", to: 5, with: ".")
/// // -> "123.."
/// ```
///
/// ```gleam
/// pad_right("123", to: 3, with: ".")
/// // -> "123"
/// ```
///
/// ```gleam
/// pad_right("123", to: 2, with: ".")
/// // -> "123"
/// ```
///
@deprecated("Use `string.pad_end` instead.")
pub fn pad_right(
string: String,
to desired_length: Int,
with pad_string: String,
) -> String {
pad_end(string, desired_length, pad_string)
}

/// Pads the end of a `String` until it has a given length.
///
/// ## Examples
Expand Down Expand Up @@ -620,20 +536,6 @@ type Direction {
Trailing
}

/// Removes whitespace on the left of a `String`.
///
/// ## Examples
///
/// ```gleam
/// trim_left(" hats \n")
/// // -> "hats \n"
/// ```
///
@deprecated("Use `string.trim_start` instead")
pub fn trim_left(string: String) -> String {
trim_start(string)
}

/// Removes whitespace at the start of a `String`.
///
/// ## Examples
Expand All @@ -648,20 +550,6 @@ pub fn trim_start(string: String) -> String {
erl_trim(string, Leading)
}

/// Removes whitespace on the right of a `String`.
///
/// ## Examples
///
/// ```gleam
/// trim_right(" hats \n")
/// // -> " hats"
/// ```
///
@deprecated("Use `string.trim_end` instead")
pub fn trim_right(string: String) -> String {
trim_end(string)
}

/// Removes whitespace at the end of a `String`.
///
/// ## Examples
Expand Down

0 comments on commit 9548d28

Please sign in to comment.