1.将www.baidu.com转化成www.udiab.moc
解题思路:1)先将字符串URL用“.”进行分割,产生一个字符串数组
2)对字符串中的数组中的每一个数组元素进行反转
坑点 :“.”
在正则表达式中,“.”是具有特殊意义的元字符,能够匹配除了换行符之外的所有的单个字符,如果使用split(".")将得到含有0个元素的数组
In regular expression, the "." is a metacharacter with special meaning which matches any single character except a newline. You got an array with zero element because "." mataches any charachers in your string.
2.java实现算法

网友评论