Question concerning pattern of ID generation

I am working on a script that interacts with the REST api and I have run into a snag during testing.

There are a few instances where I need to know explicitly with the ID will be generated by TeamCity for specific items (e.g. the VCS root ID).  In my simple use cases, I am able to determine what it will be based on the name.  For example, if the VCS name is My Repo, the ID will be something like ParentId_MyRepo.  I mistakenly assumed a simple removal of whitespace but quickly discovered that "." are also dropped.  After more testing, I can see that the Id appears to be a derivitve of the name but the casing can be very weird.

Example:

"test LOWER uPPER 1 abc 1ABC" yeilds -> TestLowerUPPER1abc1abc

It looks like there is an attempt to normalize the casing but I can't quite figure out the rules to re-implement them in code.  Can anyone give me insight to the exact rules/patterns that go into the autogenerated IDs?  If so, is there a known library that implements these rules?

Please sign in to leave a comment.