listSort and delim

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

Post Reply
User avatar
Purzelkater
Cave Troll
Posts: 41
Joined: Thu Oct 31, 2019 3:45 am

listSort and delim

Post by Purzelkater »

Sorry, it's me again... :roll:

I am right, the listSort function has no delim parameter like the other string list functions?

On most list functions you can use an delim paramter - and beacause my list entries have commas, I use this parameter many times. How can I sort my lists? Only solution I have would be to replace "," with some other strings, then create the list using "," as delim, sort it, replace the "," from the sorted list und dann replace "," back.

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: listSort and delim

Post by Full Bleed »

Purzelkater wrote:
Wed Dec 11, 2019 12:20 pm
Sorry, it's me again... :roll:

I am right, the listSort function has no delim parameter like the other string list functions?
Yeah, never noticed that before. The good thing is that it's probably not a hard fix...
On most list functions you can use an delim paramter - and beacause my list entries have commas, I use this parameter many times. How can I sort my lists? Only solution I have would be to replace "," with some other strings, then create the list using "," as delim, sort it, replace the "," from the sorted list und dann replace "," back.
You could use Wiki: json.FromList() then Wiki: json.sort() then Wiki: json.toList().
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

User avatar
aliasmask
RPTools Team
Posts: 9031
Joined: Tue Nov 10, 2009 6:11 pm
Location: California

Re: listSort and delim

Post by aliasmask »

Not sure if I've ever used Wiki: listSort() but I just checked it does have a 3rd parameter. It's just not in the wiki.

Code: Select all

[listSort("b,a;a,b","a",";")]
edit: I updated the wiki to show the delimiter option.

Post Reply

Return to “Macros”