I am wondering if/how you can "sort" a list based on the length of the text string?
For example {=sort(["bird", "lizard", "mouse"]) fn(a,b)} ⇒ ["lizard", "mouse", "bird"] or ["bird" "mouse", "lizard"].
I understand how to sort numbers {=sort([1, 5, 9, 3], (a, b) -> (b - a))} but wasn't sure how to apply it to a set of text strings, or if it's possible.
Hi @Josh_Whitchurch I was looking at your question and intrigued me JAJAJA
So I was looking into it and you can combine functions inside Text Blaze. Since the function requires numbers to compare, you can use the len() function to return the length of a string and then compare which word is the longer.
Here the solution with the example you provided.
{note}
Here you can store any list of words that you want to sort.
{A= ["bird", "lizard", "mouse","cat","Dragonfly","cow"]}
{endnote}
Thanks for the great reply Diego! Just one note, you never need to embed formulas within formulas, so instead of doing something like {=...{=len(b)}...}, you can just do {=...len(b)...}
I tweaked your example above to follow that practice.