/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/import*asstringsfrom'./strings';exportfunctionbuildReplaceStringWithCasePreserved(matches:string[]|null,pattern:string):string{if(matches&&(matches[0]!=='')){if(matches[0].toUpperCase()===matches[0]){returnpattern.toUpperCase();}elseif(matches[0].toLowerCase()===matches[0]){returnpattern.toLowerCase();}elseif(strings.containsUppercaseCharacter(matches[0][0])){returnpattern[0].toUpperCase()+pattern.substr(1);}else{// we don't understand its pattern yet.returnpattern;}}else{returnpattern;}}