1.exec是正则表达式的方法,方法参数为字符串.match为字符串的方法,参数为正则表达式对象. 2.match与exec都返回数组.如果调用exec方法的正则表达式没有分组内容,则返回第一个匹配的内容,全局匹配对它没有影响.如果正则表达式有匹配,则返回数组还包含分组匹配内容.在没有全局匹配的情况下,exec方法与match方法返回的数组一样,但是如果有全局匹配,则会返回所有匹配.如下所示: //没有全局匹配 var str="chen,zhen"; var reg=/hen/; a…
1.字符方法 1.1 charAt() 方法,返回字符串中指定位置的字符. var question = "Do you like JavaScript?"; alert(question.charAt(5)); //"u" 字符串 "Do you like JavaScript?" 的长度为23,即位置从0到22.指定位置5处的字符是"u". 1.2 charCodeAt() 方法,返回字符串中指定位置的字符编码. var…
1.slice.substring.snustr均属于String的对象方法,用于截取或提取字符串片段,三者均布破坏原先的字符串,而是以新的字符串返回被提取的部分. <script> var str="0123456"; var str1=str.slice(2,5); var str2=str.substring(2,5); var str3=str.substr(2,5); console.log(str); console.log(str1); console.log…
public class Test { public static void main(String[] args) { int[] a = {1, 2, 4, 6}; int[] b = a; int[] c = {1, 2, 4, 6}; //下面这个方法打印的是a数组的引用地址 System.out.println(a.toString()); //下面这个方法比较的是两个数组的引用是否相等 System.out.println("a.equals(b):"+a.equals(b…
public class Test { public static void main(String[] args) { int[] a = {1, 2, 4, 6}; int[] b = a; int[] c = {1, 2, 4, 6}; //下面这个方法打印的是a数组的引用地址 System.out.println(a.toString()); //下面这个方法比较的是两个数组的引用是否相等 System.out.println("a.equals(b):"+a.equals(b…
一.案例1,及解决方案: "LINQ to Entities 不识别方法"System.String ToString()",因此该方法无法转换为存储表达式." 原因是LINQ to Entities 不支持ToString()函数. 可用下述方法进行转换解决: string str= "1,2,3,4,5,6,7,8,9,0"; List<int> result = new List<string>(str.Split(…