Microsoft.Azure.Commands.Network.ChildResourceHelp.NormalizeId C# (CSharp) Method

NormalizeId() private static method

private static NormalizeId ( string id, string resourceName, string resourceValue ) : string
id string
resourceName string
resourceValue string
return string
        private static string NormalizeId(string id, string resourceName, string resourceValue)
        {
            int startIndex = id.IndexOf(resourceName, StringComparison.OrdinalIgnoreCase) + resourceName.Length + 1;
            int endIndex = id.IndexOf("/", startIndex, StringComparison.OrdinalIgnoreCase);

            // Replace the following string '/{value}/'
            startIndex--;
            string orignalString = id.Substring(startIndex, endIndex - startIndex + 1);

            return id.Replace(orignalString, string.Format("/{0}/", resourceValue));
        }