typescript代码判断20220317013044631_1000_1_9420543是否包含9420543
const str1 = "20220317013044631_1000_1_9420543";
const str2 = "9420543";
if (str1.includes(str2)) {
console.log(`${str1} 包含 ${str2}`);
} else {
console.log(`${str1} 不包含 ${str2}`);
}
输出结果为:20220317013044631_1000_1_9420543 包含 9420543
原文地址: https://www.cveoy.top/t/topic/i5sQ 著作权归作者所有。请勿转载和采集!