forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


@match function

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
dmonckton
Contributor
Contributor


Joined: 09 Aug 2002
Posts: 117
Location: Lewes, U.K.

PostPosted: Sat Jan 12, 2019 2:45 pm    Post subject: @match function Reply with quote

Hi All

The @match function in v5 is crap!

I have a list which contains both mix & x, mix occurs first. If I use @match to find x it always finds mix instead(because it contains x). I want an exact match so wrote my own function to do it...

Code:

:exMatch
rem %1 = list to search
rem %2 = string to find
list seek,%1,0
repeat
    if @equal(@next(%1),%2)
        %x = @pred(@index(%1))
    end
until @not(@ok())%x
exit %x


Is there a better/faster way to do it? I concerned about the overhead of looping through the list each time.

Kind regards

David
Back to top
View user's profile Send private message
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 762
Location: Rockeledge, GA

PostPosted: Thu Jan 17, 2019 4:27 am    Post subject: Reply with quote

I would continue to use the match function (in a loop) but reject results where the length of the string is greater than 1.

Still sucks, but should be faster than looping every line item.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group