Browse Source

:bug: rewrite `startsWith`、`endsWith` methods

zhanghe 6 years ago
parent
commit
73f3c1a911
1 changed files with 11 additions and 0 deletions
  1. 11 0
      src/stage/index/index.html

+ 11 - 0
src/stage/index/index.html

@@ -73,6 +73,17 @@
 		var globalUseDurationRecord = 0;
 		var globalUseDurationRecord = 0;
 		setInterval('globalUseDurationRecord += 1', 1000);
 		setInterval('globalUseDurationRecord += 1', 1000);
 	</script>
 	</script>
+	<script>
+		//解决startsWith、endsWith在webview上不能使用问题
+		String.prototype.startsWith=function(str){
+			var reg=new RegExp("^"+str);
+			return reg.test(this);
+		}
+		String.prototype.endsWith=function(str){
+			var reg=new RegExp(str+"$");
+			return reg.test(this);
+		}
+	</script>
 </body>
 </body>
 
 
 </html>
 </html>