If I have a string "key:<String || UUID>"
is there a way where I can extract the string and differentiate of the part after :
is a string or a UUID?
Example: in this key:863864947148451183L
and key:1234
May be by using the size of a UUID or the number of bytes?
The only foolproof way is to use
UUID.fromString(yourString);
It will return an
java.lang.IllegalArgumentException: Invalid UUID string: "someString"
Handle the exception.
The javadoc explains the UUID format.