Implement a function to determine if two occupancy tags are compatible and which one is the more specific
After introducing the more detailed occupancy tags to taxonomy-lib, a function is needed that determines if two occupancy tags are compatible and which one is the more specific. This procedure should follow these cases (here presented in examples):
Building tag | Asset tag | Return value |
---|---|---|
COM2 | COM2 | COM2 |
COM | COM2 | COM2 |
COM3 | COM2 | None |
IND2 or IND | COM2 | None |
COM2 | COM | COM2 |
RES2A | RES | RES2A |
RES2A | RES2 | RES2A |
The basic principle is that if one of both tags is a substring of the other (or equal), the two tags are compatible and the longer one is to be used as return value.