codeWars java practice

codewars官网

01 比较字符串末端是否相同

  1. 字符串转字符数组并通过遍历后几位来比较是否相同
  2. 根据比较字符串长度截取被比较字符串再通过str.equals(ending)比较得出是否相等
  3. 直接通过str.endsWith(ending)得出是否相等
posted @ 2021-10-18 23:12  lambertlt  阅读(30)  评论(0编辑  收藏  举报