This shortcut reversed the values and keys but only works when you do not have duplicate values
What's New
Version 1.0
First release
What it does
14 actions-
CommentThis will only work if there are no duplicate values or keys
-
Dictionary
-
Set VariableD
-
Get Variable
-
Get Dictionary Value
-
Repeat with Each
-
Get Variable
-
Get Dictionary Value
-
Text
-
Add to Variable
-
Get Variable
-
Combine Text
-
Text
-
Get Dictionary from Input
View as code
Every action of this Shortcut written out as Cherri, a programming language for Shortcuts. Great for learning how it works.
#define color lightblue
#define glyph magicWand
// This will only work if there are no duplicate values or keys
@D = {
"1": "2",
"3": "4",
"5": "6"
}
// TODO: Get Variable not supported: Assign variable here to '@D'.
getKeys({})
for _ in nil {
// TODO: Get Variable not supported: Assign variable here to '@D'.
@ReverseD += "\\"{}\\":\\"{@RepeatItem}\"
}
// TODO: Get Variable not supported: Assign variable here to '@ReverseD'.
joinText(nil, ",")
getDictionary(nil)
Open in Cherri Playground
Decompiled with cherri 2.3.0 (GPL-2.0). May need small fixes before it compiles.
Ratings & Reviews
Write a Review–
out of 5
★★★★★
★★★★
★★★
★★
★
0 ratings
No reviews yet. Be the first to share what you think!
Advertisement
More by chefchip1965
You Might Also Like
Advertisement