longest_repeated_substring

Function longest_repeated_substring 

Source
pub fn longest_repeated_substring(sv: &str) -> String
Expand description

Find the longest repeating non-overlapping substring in cstr

The longest_repeated_substring function takes a null-terminated string and its length as input and returns the longest repeated non-overlapping substring in the string.

Arguments:

  • sv: A reference to a character array representing the input string. It is assumed that the string is null-terminated.

Returns:

The function longest_repeated_substring returns a string, which is the longest repeated substring in the given input string cstr.

ยงExamples

use csd::lcsre::longest_repeated_substring;

let cs = "+-00+-00+-00+-0";
assert_eq!(longest_repeated_substring(&cs), "+-00+-0");
let cs = "abcdefgh";
assert_eq!(longest_repeated_substring(&cs), "");