seaswalker / posts

0 stars 0 forks source link

Apache commons StringUtils #27

Open seaswalker opened 3 years ago

seaswalker commented 3 years ago

一些不怎么常用的很好用的方法.

查询字符出现次数

StringUtils.countMatches(name, '/')

查询字符串第n此出现的下标

StringUtils.ordinalIndexOf(name, "/", 5);

这个是符号/第5次出现的位置。