Function lodust::ends_with[][src]

pub fn ends_with(s: String, target: String, position: Option<i32>) -> bool
Expand description

(String) Checks if string ends with the given target string.

If the position to search up to is not provided, we will search through the whole string by default.

Example

use lodust::ends_with;

let is_ends_with = ends_with("abc".to_string(), "c".to_string(), None);
// => true

let is_ends_with = ends_with("abc".to_string(), "b".to_string(), None);
// => false

let is_ends_with = ends_with("abc".to_string(), "bc".to_string(), Some(2));
// => false