1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright © 2024 PDF Composer (pdf_composer). All rights reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
use MAIN_SEPARATOR;
/// /// Extracts a substring from a given string starting from the last occurrence of the OS-specific delimiter (MAIN_SEPARATOR).
///
/// # Arguments
///
/// * `input` - A string from which the substring will be extracted.
///
/// # Returns
///
/// An option containing the extracted substring, or None if the string does not contain the delimiter.
///
/// # Examples
///
/// ```
/// // Import the function into scope
/// use your_module::extract_to_end_string;
///
/// // Define an input string containing directory path
/// let input_string = "/path/to/some/directory/";
///
/// // Extracts "directory/" from "/path/to/some/directory/"
/// assert_eq!(extract_to_end_string(input_string), Some("directory/"));
///
/// let input_string = "/path/to/some/file.txt";
///
/// // Since there's no delimiter, the original string is returned
/// assert_eq!(extract_to_end_string(input_string), Some("/path/to/some/file.txt"));
///
/// let input_string = "/";
///
/// // Since the last delimiter is the last character in the string, None is returned
/// assert_eq!(extract_to_end_string(input_string), None);
/// ```