Definition: | object key = getd_partial_key(object pkey, integer tid=1, bool rev=false) |
Description: |
Retrieve the first key equal to or greater than (or less than if rev is true) the specified partial key.
tid can be omitted, to use the default dictionary, or the result of a previous new_dict() call. |
Comments: |
As per getd()/getd_by_index(), this function can return
0/the setd_default() value for non-existent keys and may need similar logic.
Equally, as per the example below, it is up to the calling program to decide whether "this" is of any use, when it does not actually start with the partial key, in that case "the". This routine is a "single-shot" variant of traverse_dict_partial_key(); obviously the latter must be used should you want to "carry on" in any way. This function is not thread-safe: locking must be used if two threads are not to over-clobber each others results, even when reading from entirely separate dictionaries. |
Example: |
setd("this",0) setd("that",0) setd("those",0) ?getd_partial_key("the") -- prints "this" |
See Also: | getd, setd_default, getd_index, traverse_dict_partial_key |