예제 #1
0
 private String parseParentName(TagMapEntity entity) {
   String tag = entity.getTag();
   // not used, for example, youku, 视频/动漫/益智 <-> 教育
   // if(!tag.endsWith(entity.getCategory())) return null;
   int lastSlash = tag.lastIndexOf("/");
   if (lastSlash <= 0) {
     return null;
   }
   // 查找倒数第二个“/”的位置
   int penultSlash = tag.lastIndexOf("/", lastSlash - 1);
   if (penultSlash == -1) {
     return null;
   }
   return tag.substring(penultSlash + 1, lastSlash);
 }