CreateDataObjectName return value for duplicate folder name

My goal is to create a unique and legal name for a new data folder using CreateDataObjectName, but the result is not as I anticipated from reading the help info.

With the function written as:

CreateDataObjectName(dfr, sNewFolder, 11, 0, 0)

where dfr is "root:" and sNewFolder is "Training_Ref_and_Clean_Glass".

The first execution of CreateDataObjectName with no folder of the given name in root, returns "Training_Ref_and_Clean_Glass".  After that folder is created, a second execution returns "Training_Ref_and_Clean_Glass0".  After that folder is created, a third and further executions always return "Training_Ref_and_Clean_Glass0".   To be clear, each time CreateDataObjectName  is executed, sNewFolder is set to "Training_Ref_and_Clean_Glass".

My expectation was that the suffix would increment to suggest a unique name, for example after "Training_Ref_and_Clean_Glass0" was created, the next execution would return, "Training_Ref_and_Clean_Glass1", like "UniqueName".

Did I miss something in the function explanation?

 

I have fixed CreateDataObjectName() for the next nightly build. Be sure to get build #39125 or later.