str_substr

Function str_substr 

Source
pub fn str_substr(s: &SmtString, i: i32, n: i32) -> SmtString
Expand description

Substring of s that starts at index i and has length at most n

  • Return the empty string if n < 0 or i is not in [0 .. s.len-1]
  • If s has length at least i+n, return the substring s[i…i+n-1]
  • If s has length less than i+n, return the substring s[i .. s.len-1]

§Example

use aws_smt_strings::smt_strings::*;

let s = SmtString::from("abcdef");

assert_eq!(str_substr(&s, 2, 3), SmtString::from("cde"));