lq-text: LQT_OnlyWithinWord

API int LQT_OnlyWithinWord (db, ch) t_LQTEXT_Database *db; int ch;

Purpose

Returns non-zero only if the given character ch can appear within a word but not at the start or end, and not repeated consecutively. For English, an apostrophe (') is normally considered to be the only such character; it's found in wouldn't, can't, and o'clock. You could also include the hyphen if you wanted, but it turns out to be best to index `match-box' as two separate words with punctuation between them, rather than as a single word.

This function is normally a macro declared in the header file <wordrules.h> but can also be defined as a C function is greater complexity is needed and the indexing speed loss is not a concern.

Returns

zero or non-zero.

Bugs

This routine is only sensible for English.

See Also: