mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-28 22:47:20 +02:00
Enhancement
- Modified the closeEnough function to accept a minimum match length. Useful, but initially not used.
This commit is contained in:
parent
b63bd9e985
commit
f23d8921e4
2 changed files with 7 additions and 3 deletions
|
@ -676,12 +676,16 @@ bool compare (
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool closeEnough (const std::string& reference, const std::string& attempt)
|
||||
bool closeEnough (
|
||||
const std::string& reference,
|
||||
const std::string& attempt,
|
||||
unsigned int minLength /* = 0 */)
|
||||
{
|
||||
if (compare (reference, attempt, false))
|
||||
return true;
|
||||
|
||||
if (attempt.length () < reference.length ())
|
||||
if (attempt.length () < reference.length () &&
|
||||
attempt.length () >= minLength)
|
||||
return compare (reference.substr (0, attempt.length ()), attempt, false);
|
||||
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue