08 2021 档案
摘要:源码地址 点击查看演示源码 Vue2父子传参:props 首先在父组件中引入子组件,然后以属性的方式将数据传递给子组件 父组件: <template> <div class="home"> <!-- 在子组件中使用 :变量名=value 的方式向子组件传递数据,子组件通过 props 接收--> <
阅读全文
摘要:使用 localeCompare() 方法来进行字符串排序 let str = "qwertyuasdfghjzxcvbn"; str = [...str].sort((a,b)=>{ return a.localeCompare(b,"zh-CN") }).join("") console.log
阅读全文
摘要:@Test public void show(){ String s1 = "qwertyasdfghzxcvbn"; String s2 = myStrSort(s1); System.out.println(s2); //=> abcdefghnqrstvwxyz } public String
阅读全文
摘要:@Test public void testGetSomeStr() { String a = "sffioafihellosdfvasdf"; String b = "sfhellodesdfs"; String c = getSomeStr(a, b); System.out.println(c
阅读全文
摘要:方式一:使用 replace 的方式计算字符串出现次数 @Test public void show() { String s1 = "absfsdfabsdfosfabsfspfoj"; String s2 = "ab"; // 获取原始字符串的长度 int oldCount = s1.lengt
阅读全文
摘要:方式一 @Test public void show() { String s1 = "abcdefg"; String s2 = "a"; // 先将需要翻转的字符串给截取出来 char[] chars = s1.substring(1, 6).toCharArray(); // 循环截取出来的字
阅读全文
摘要:public class StringDemo1 { @Test public void show() { String s1 = " hello world sss "; String s2 = myTrim(s1); System.out.println(s2); //=> hello worl
阅读全文