findAcronymAt

Find needle as Word or Symbol Acronym at haystackOffset in haystack. TODO: Make it compatible (specialized) for InputRange or BidirectionalRange.

@safe pure
Tuple!(R, ptrdiff_t[])
findAcronymAt
(
alias pred = "a == b"
R
E
)
(,
in E needle
,,
CaseSensitive cs = CaseSensitive.yes
,
size_t haystackOffset = 0
)

Examples

assert("size_t".findAcronymAt("sz_t", FindContext.inWord)[0] == "size_t");
assert("size_t".findAcronymAt("sz_t", FindContext.inSymbol)[0] == "size_t");
assert("åäö_ab".findAcronymAt("ab")[0] == "ab");
assert("fopen".findAcronymAt("fpn")[0] == "fopen");
assert("fopen_".findAcronymAt("fpn")[0] == "fopen");
assert("_fopen".findAcronymAt("fpn", FindContext.inWord)[0] == "fopen");
assert("_fopen".findAcronymAt("fpn", FindContext.inSymbol)[0] == "fopen");
assert("f_open".findAcronymAt("fpn", FindContext.inWord)[0] == []);
assert("f_open".findAcronymAt("fpn", FindContext.inSymbol)[0] == "f_open");

Meta