我有一个如下所示的字符串
https://maps.googleapis.com/maps/api/streetview?channel=rdc-ldp-streetview&client=sourcemaps
如何检查返回的变量值是否与:
匹配
https://maps.googleapis.com/maps/api/streetview
答案 0 :(得分:0)
ES6
str.startsWith('https://maps.googleapis.com/maps/api/streetview');
ES5
str.indexOf('https://maps.googleapis.com/maps/api/streetview') === 0