zoukankan      html  css  js  c++  java
  • Java字符串复制

    Java字符串复制

     1     public boolean topicFilterMatch(String topicFilter, String topic) {
     2         if (topicFilter == null || topic == null) {
     3             return false;
     4         }
     5 
     6         if (topicFilter.startsWith("$queue/"))
     7             topicFilter = topicFilter.substring(7);
     8         if (topicFilter.startsWith("$share/")) {
     9             int index = topicFilter.indexOf("/", 7);
    10             topicFilter = topicFilter.substring(index + 1);
    11         }
    12 
    13         String[] filterTokens = topicFilter.split("/");
    14         String[] topicTokens = topic.split("/");
    15         if (filterTokens.length > topicTokens.length) {
    16             return false;
    17         }
    18 
    19         for (int i = 0; i < filterTokens.length; i++) {
    20             if (filterTokens[i].equals("#")) {
    21                 // '#' must be the last character
    22                 return ((i + 1) == filterTokens.length);
    23             }
    24 
    25             if (!(filterTokens[i].equals(topicTokens[i]) || filterTokens[i].equals("+"))) {
    26                 return false;
    27             }
    28         }
    29 
    30         return (filterTokens.length == topicTokens.length);
    31     }
  • 相关阅读:
    hdu 4460spfa用map来实现
    hdu 2579
    hdu 2845
    hdu 4462
    hdu 4557
    hdu 4639
    URAL 2078 Bowling game
    UVA
    HDU 5773 The All-purpose Zero 脑洞LIS
    Codeforces Round #368 (Div. 2) C. Pythagorean Triples 数学
  • 原文地址:https://www.cnblogs.com/myfrank/p/8514391.html
Copyright © 2011-2022 走看看