Function egg_mode_text::reply_mention_entity
[−]
[src]
pub fn reply_mention_entity(text: &str) -> Option<Entity>
Parses the given string for a user mention at the beginning of the text, if present.
This function is provided as a convenience method to see whether the given text counts as a
tweet reply. If this function returns Some
for a given draft tweet, then the final tweet is
counted as a direct reply.
Note that the entity returned by this function does not include the @-sign at the beginning of the mention.
Examples
use egg_mode_text::reply_mention_entity; let text = "@rustlang this is a reply"; let reply = reply_mention_entity(text).unwrap(); assert_eq!(reply.substr(text), "rustlang"); let text = ".@rustlang this is not a reply"; assert_eq!(reply_mention_entity(text), None);