Function split_content

Source
pub fn split_content(content: &str) -> (Vec<String>, String)
Expand description

Splits a content string into tags and sentences.

This function takes a string in the format “tag1, tag2, tag3., Sentence text” and splits it into a vector of tags and the remaining sentence text.

§Arguments

  • content - The string to split, expected to be in the format “tags., sentence”

§Returns

  • (Vec<String>, String) - A tuple containing:
    • A vector of tag strings
    • The remaining sentence text

§Examples

use dset::split_content;
 
let content = "tag1, tag2, tag3., This is a sentence.";
let (tags, sentence) = split_content(content);
assert_eq!(tags, vec!["tag1", "tag2", "tag3"]);
assert_eq!(sentence, "This is a sentence.");