private static string StripPrefixIfNecessary()

in src/NMS.AMQP/Util/AmqpDestinationHelper.cs [105:128]


        private static string StripPrefixIfNecessary(string address, IAmqpConnection connection, byte type)
        {
            if (address == null)
                return null;

            if (type == MessageSupport.JMS_DEST_TYPE_QUEUE)
            {
                string queuePrefix = connection.QueuePrefix;
                if (queuePrefix != null && address.StartsWith(queuePrefix))
                {
                    return address.Substring(queuePrefix.Length);
                }
            }
            else if (type == MessageSupport.JMS_DEST_TYPE_TOPIC)
            {
                string topicPrefix = connection.TopicPrefix;
                if (topicPrefix != null && address.StartsWith(topicPrefix))
                {
                    return address.Substring(topicPrefix.Length);
                }
            }

            return address;
        }