Details
-
Improvement
-
Resolution: Unresolved
-
Minor
-
None
-
None
-
None
-
None
Description
Given a string formatted as a follows:
app:department:it:it_application or app:department:it:it_application:
A simple function would be to return the last stem name.
Template: function parentStem(stemDN)
parentStem('app:department:it:it_application') returns it_application
parentStem('app:department:it:it_application:') returns it_application
As an optional enhancement, it should return the name of the stem at <index> from the end.
Template: function parentStem2(stemDN, indexFromEnd)
parentStem2('app:department:it:it_application',0) returns it_application
parentStem2('app:department:it:it_application',1) returns it
The function could be simple or complex depending upon how much one would handle bad index parameters or how complex you want to make the function.
Handling or not handling trailing colons would be a choice.