"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.StringUtils = void 0;
class StringUtils {
    static equalsWithCase(strA, strB) {
        return strA === strB;
    }
    static equalsWithIgnoreCase(strA, strB) {
        return strA.toLowerCase() === strB.toLowerCase();
    }
    static isNullOrWhiteSpace(s) {
        return s === null || s === undefined || s.trim() === '';
    }
    static isBlankByCdmStandard(s) {
        return StringUtils.isNullOrWhiteSpace(s);
    }
    /**
     * Capitalizes first letter of the given string.
     * @param str The source string to be capitalized.</param>
     */
    static capitalizeValue(str) {
        if (StringUtils.isNullOrWhiteSpace(str)) {
            return "";
        }
        return str[0].toUpperCase() + (str.length > 1 ? str.slice(1) : '');
    }
    /**
     * Replaces in the pattern in the source with the value.
     * @param source The source string
     * @param pattern A pattern in the format {p}. The code will try to find {p} and {P}
     * @param value The value to be replaced instead of the pattern
     */
    static replace(source, pattern, value) {
        if (value === undefined) {
            value = '';
        }
        const lowerCasePattern = pattern.toLowerCase();
        const upperCasePattern = StringUtils.capitalizeValue(pattern);
        const upperCaseValue = !StringUtils.isNullOrWhiteSpace(value) ? StringUtils.capitalizeValue(value) : "";
        const result = source.replace(`{${lowerCasePattern}}`, value);
        return result.replace(`{${upperCasePattern}}`, upperCaseValue);
    }
}
exports.StringUtils = StringUtils;
//# sourceMappingURL=StringUtils.js.map