Kevin Ryde
and 1 contributors


App::Chart::SymbolMatch -- loose matching of symbols


 use App::Chart::SymbolMatch;


This module is used for loose symbol entry on the command line and in the Open dialog (see App::Chart::Gtk2::OpenDialog). It's only a separate module to keep a tricky bit of code away from other things.


($symbol, $symlist) = App::Chart::SymbolMatch::find ($target)
($symbol, $symlist) = App::Chart::SymbolMatch::find ($target, $preferred_symlist)

Find a symbol for the partial string $target in the symlists and return the symbol and symlist, or return no values if nothing matches (which include when $target is the empty string "").

Progressively looser matches are attempted. So first an exact match in the given $preferred_symlist, otherwise other lists. Otherwise a case-insensitive match, or a match without suffix (but always following an explicit suffix on $target), or a partial match at the start of the symbol, and possibly without the index "^" marker.

The effect is that for instance a $target "bh" might match "BHP.AX", or "gsp" might match "^GSPC". Note that an exact match anywhere is preferred over a partial match in the current list, because otherwise you could type an exact full symbol like "FOO" and still be left on a "FOO.AX" in the current list.





Copyright 2008, 2009, 2010, 2011, 2015, 2016 Kevin Ryde

Chart is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

Chart is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Chart; see the file COPYING. Failing that, see