Re: match()

new topic     » goto parent     » topic index » view thread      » older message » newer message

Hello Aku, you wrote:

> match("", "something") shows an error
> first argument of match() must be a non-empty sequence
>
> I think it should return 1,

The equivalent function to match() in BASIC is instr(), and that's
actually the way instr() works.
My experience after about 10 years programming in BASIC is, that this
often causes problems. Especially it can cause bugs, that are very hard
to find by beginners.

> because "" is a substring of "something",
> and is located in any position.

This is a philosophical question, isn't it? blink

> So I don't have to check if the first argument is "", don't call
> match().
>
> How do you think?

Best regards,
   Juergen

-- 
 /"\  ASCII ribbon campain  | "Everything should be made as simple
 \ /  against HTML in       |  as possible, but not simpler."
  X   e-mail and news,      |
 / \  and unneeded MIME     |  http://www.sfheart.com/einstein.html

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu