Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

Dictionary.KeysWithPostfix

Returns list with all keys matching postfix.

Component Version macOS Windows Linux Server iOS SDK
Dictionary 11.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "Dictionary.KeysWithPostfix"; DictionaryRef; Postfix )   More

Parameters

Parameter Description Example
DictionaryRef The reference number to the dictionary. $dic
Postfix The postfix text ".length"

Result

Returns list or error.

Description

Returns list with all keys matching postfix.
The order is random and defined by how the dictionary internally stores values.
See also Dictionary.Keys.

The postfix and prefix keys functions allows you to organize things in the dictionaries with e.g. dot notation. You may have entries like "person.123.firstname" and "person.123.lastname" and by using Dictionary.KeysWithPostfix you can look for ".firstname" to find all keys ending with this postfix.

Examples

Try it:

Let([
// create a dicitonary
dic = MBS( "Dictionary.Create");
// fill in some values:
t = MBS( "Dictionary.SetValueForKey"; dic; "person.123.firstname"; "John" );
t = MBS( "Dictionary.SetValueForKey"; dic; "person.123.lastname"; "Miller" );
t = MBS( "Dictionary.SetValueForKey"; dic; "person.456.firstname"; "Tom" );
t = MBS( "Dictionary.SetValueForKey"; dic; "person.456.lastname"; "Smith" );
// and query keys:
r = MBS( "Dictionary.KeysWithPostfix"; dic; ".lastname" )
]; r)

Example result:
person.456.lastname
person.123.lastname

See also

Release notes

Blog Entries

This function checks for a license.

Created 18th July 2021, last changed 19th July 2021


Dictionary.Keys - Dictionary.KeysWithPrefix