[][src]Function rust_algorithm::gcd_of_strings

pub fn gcd_of_strings(str1: String, str2: String) -> Option<String>

求两个字符串的最大公约字符串

Arguments

  • str1 - 第一个字符串
  • str2 - 第二个字符串

Examples

use rust_algorithm::gcd_of_strings;
let result = gcd_of_strings(String::from("ABCABCABC"), String::from("ABC"));
assert_eq!(result.unwrap(), "ABC");