Community discussions

MikroTik App
adamd292
newbie
Topic Author
Posts: 48
加入: Tue Oct 07, 2008 8:56 am

string_compare problem

Thu Feb 12, 2009 5:45 am

If I set this as the label for a device:
Code:Select all
[string_compare("dude","dude")] [string_compare("notdude","dude")] [string_compare("dude","")] [string_compare("","dude")]
The description appears as:
4
7
4
0

This is not correct - string_compare says it returns 0 when the strings are the same/

I think there may be a problem - It is like string_compare is doing the same thing as string_size.
Top
用户头像
teslasystems
刚刚加入了
Posts: 19
加入: Sun Aug 09, 2015 3:00 pm

Re: string_compare problem

Sat May 18, 2019 8:02 pm

Looks like already 10 years passed, but I have the same problem now in 6.44.3 version. It should be fixed!
Top
lebowski
Forum Guru
Forum Guru
Posts: 1619
加入: Wed Aug 27, 2008 5:17 pm

Re: string_compare problem

Tue Jun 04, 2019 5:47 pm

The first post on the probe thread says to use -1 for false...

Cisco CPU
Type: Function
Available: if(oid("1.3.6.1.4.1.9.2.1.58.0")>0, 1, -1)

but -1 is true, try it...
[if(-1,"-1 is true","-1 is false")]

This incorrect information should corrected, anyhow why use -1 for false when 0 is precise unless you are passing a value to another function just use 0.
Great program but fixes are slow if at all.
Top

Who is online

Users browsing this forum: No registered users and 2 guests