[Gambas-devel] libnodave

Benoit Minisini gambas at ...1...
Tue Feb 22 16:04:43 CET 2005


On Tuesday 22 February 2005 15:54, Rob wrote:
> On Tuesday 22 February 2005 05:51, Benoit Minisini wrote:
> > STATIC PUBLIC FUNCTION match(subject AS String, pattern AS
> > String) AS Boolean
> > Can you add a class named "Matches" with a static "_call"
> > method that implements the same behaviour ?
> > This way, for simple uses of RegExp, user will only have to
> > call:
> > IF Matches("MyString", "MyPattern") THEN ...
> > What do you think about that ?
>
> Sure, I had that in an earlier unreleased revision of the
> component.... I'll dig out my code and clean it up.
>
> Did you mean Regexp.Matches("MyString", "MyPattern") or is there
> some way I can use interpreter hooks to export the Matches
> symbol so it can be used without specifying the Regexp class?
>
> Rob
>

No, but if a class has a "_call" method, then this class can be used like a 
function.

Matches("s", "p") <=> Matches._call("s", "p").

For a simple search, I think we need a function-like class, otherwise, the 
user has to create an instance of RegExp and uses one of its method 
everytime.

Regards,

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the Devel mailing list