Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: How to represent negative number (Read 4602 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

How to represent negative number

I wanted to sort albums in Album list descending by DATE, so I tried [font= "Lucida Console"]$sub(%date%,$mul(%date%,2))[/font], but unfortunately it didn't worked. Number is correctly presented but it doesn't affect sorting as it should.
If I try with [font= "Lucida Console"]$sub(%date%,3000)[/font] it works OK, only that DATE is now represented with unwanted number.

Is there some other way to represent the negative number in foobar which is suitable for sorting?

 

How to represent negative number

Reply #1
No, the sorting is always text-based. In the end, your expression is exactly the same as just "-%date%".
It uses some logical sorting rules, e.g. "Track 2" < "Track 10", but that doesn't care about negative numbers, obviously.
(No, the rules are not customizable, it's what one Windows API does.)


But Unicode is fun <3
Try this:
Code: [Select]
$char(8238)$sub(3000,%date%)$repeat($char(8195),50)$char(8237)'['%date%']' %album%[ '['%album artist%']']|[[%discnumber%.]%tracknumber%. ][%track artist% - ]%title%
Full-quoting makes you scroll past the same junk over and over.

How to represent negative number

Reply #2
I tried first with adding minus sign  than $sub(0,%date%) and what else not... $sub(%date%,3000) led me to my stupidity to think that it sorts negative numbers correctly although $sub() was done by fixed number - but I was tired I guess

as for the code, thanks Yirkha
Although I can't find 202A-202F characters in charmap, I found that involved characters are LTR and RTL override, and if put horizontal scroll in Album list I see where $sub(3000,%date%) is