// Package roomid defines the room identifier format shared by gateway and room-service. package roomid const ( // MaxStringIDLength keeps room_id within both Tencent IM GroupID and RTC strRoomId limits. MaxStringIDLength = 48 ) // ValidStringID reports whether value can be used as the internal room_id and Tencent room identifier. func ValidStringID(value string) bool { if len(value) == 0 || len(value) > MaxStringIDLength { return false } for i := 0; i < len(value); i++ { char := value[i] if char >= 'a' && char <= 'z' { continue } if char >= 'A' && char <= 'Z' { continue } if char >= '0' && char <= '9' { continue } if char == '_' || char == '-' { continue } return false } return true }