2017-03-24 11 views
-1

私の主な方法は、文字列zachを別々の配列に分割し、大文字にし、カンマとピリオドを削除するために書かれています。私はisNonStopMethodを書いて、特定のストップワードを特定しようとしています( "THE"、 "BE"、 "TO"、 "OF"、 "AND"、 "A"、 "IN"、 "THAT '通常の "IT"、 "ON"、 "IN"、 "BUT"、 "IS"、 "WITH")は、文字列ザックで見つかった。私は、文字列でこれらのキーワードを探して助けが必要。複数のメソッドを持つキーワードの文字列を検索

package zk; 

public class Class { 

    public boolean isNonStopWord(int[] nums, int value) 
    { 
    ("THE", "BE", "TO", "OF", "AND", "A", "IN", "THAT", 
      "I", "IT", "ON", "IN", "BUT", "IS", "WITH"); 
      return false; 
    } 


    public static void main(String [] args) { 

      String zach = ("Amazon offered up more answers Thursday about what" 
          + " caused a bunch of websites to fail two days ago. According " 
          + "to a postmortem by the company's cloud services business, " 
          + "around 9:37 a.m. PT Tuesday an Amazon worker incorrectly" 
          + " punched in a command while trying to debug an issue. " 
          + "That command shut down a large set of servers at Amazon Web " 
          + "Services' Northern Virginia site, causing a domino effect of" 
          + " problems. Other services that relied on those S3 cloud" 
          + " storage servers were disrupted. Also, removing so much " 
          + "server capacity required a full system restart, which then " 
          + "took longer than expected, AWS said. The sites affected " 
          + "included Quora, Imgur, IFTTT, Giphy and Slack. Amazon was " 
          + "able to fix the issue by about 2 p.m. PT."); 
      zach = zach.replace(",",""); 
      zach = zach.replace(".",""); 
    zach = zach.toUpperCase(); 
    String [] strings = zach.split(" "); 
    for (String s1: strings) { 
      System.out.println(s1); 

    } 
    } 



} 
+1

は 'String.indexOf()を試してみてください;'。 –

答えて

関連する問題