pub fn word_at_offset(text: &str, offset: usize) -> Option<&str>Expand description
Extract the word (identifier) at the given byte offset.
A word consists of ASCII alphanumeric characters, underscores, dots, and hyphens.
Returns None if the offset is not on a word character.
ยงExample
use makefile_lossless::word_at_offset;
assert_eq!(word_at_offset("hello world", 0), Some("hello"));
assert_eq!(word_at_offset("hello world", 5), None); // space
assert_eq!(word_at_offset("hello world", 6), Some("world"));