How can I distinguish between a name and UUID?
I'm working on a script that uses the RTC CLI to access RTC in which a user can reference an RTC object by either its name or its UUID. How can I determine if the user referenced the object by name or UUID. Can I take the object reference to be UUID if and only if it begins with an underscore?
Accepted answer
If you have access to the RTC plain-Java API, you can call com.ibm.team.repository.common.UUID.valueOf(userSuppliedValue), and if that call throws an IllegalArgumentException, then it was not a valid UUID (that's the main fool proof way).
(but yes, a UUID is 22 characters long and starts with an _ , but just keep in mind it's always possible for a crazy user to have a stream name start with an underscore and happen to also be 22 characters long)