char c = 'w'; int index = s.indexOf(c); if (index != -1) { String sub = s.substring(0, index); System.out.println(sub); // Outputs "Hello, " } ...
確定! 回上一頁