class temp
{
public static void main(String []args)
{
String [] arp = new String [] {"Sarah is a good girl","Sarah is a bad girl"} ;// I only want to print "good" from this array and not the entire string in the below println statement.
System.out.println(arp[0]);//this will print the entire string on element[0] while i only want to print "good" from that string.
}
}
Wenn dieses Problem gelöst ist, wird meine vorherige Frage ebenfalls gelöst.Wie drucke ich nur bestimmte Details aus dem String-Array?
Blick in 'substring' – Idos
' System.out.println ("gut") '? Scheint, du musst in deiner Frage spezifischer sein. Willst du vielleicht das X in "Sarah ist ein X Mädchen" oder sogar "Y ist ein X {Mädchen/Junge}" identifizieren? –
@Samon Fischer Danke für deine Antwort, aber diese Saite ist nur ein Beispiel, da könnte alles an diesem Ort nicht nur gut sein. Ich möchte eine Technik oder eine Methode, bei der ich nur den vierten Teil drucken kann, wo "gut" steht. "Dies ist ein schönes Haus" Ich möchte nur "Haus", das ist das fünfte Wort oder "gut", das vierte Wort ist. Ist das möglich, was ich frage? – user25142514