解析字符串 - 应该是换行符的结束索引?

Your request for ...

Good morning Mr Praneel PIDIKITI
you have succ.....
这是我想要解析此字符串的字符串,以获得Praneel PIDIKITI的值 我在用
  int begin_index = 0;
    int end_index = 0;

    String startkeyword = "Good morning";
    String endKeyword = " ???";
    int main_begin_index = lines[i].indexOf(startkeyword, begin_index);
    begin_index = main_begin_index;
    end_index = lines[i].indexOf(endKeyword, begin_index);

    String Name= lines[i].substring(begin_index + startkeyword.length(), end_index).trim();
什么应该是我的endKeyword,因为它是行的结尾??? 谁能帮我 ....     
已邀请:
你可能最好使用Regexp。
    Pattern p = Pattern.compile("Good morning (.*)");
    Matcher m = p.matcher(line[i]);
    String name = "";
    if (m.find())
        name = m.group(1);
    

要回复问题请先登录注册