Ich habe aus einem Tutorial diese Seite hier: https://docs.oracle.com/javase/7/docs/api/java/lang/String.html
Aber ich verstehe nicht wie ich die Codes in meinen Quellcode einbaue.
Könnte jemand bitte ein Beispiel geben mit z.B.: lastIndexOf
Das steht auf der Seite darüber:
lastIndexOf
public int lastIndexOf(int ch)
Returns the index within this string of the last occurrence of the specified character. For values of ch in the range from 0 to 0xFFFF (inclusive), the index (in Unicode code units) returned is the largest value k such that:
this.charAt(k) == ch
is true. For other values of ch, it is the largest value k such that:
this.codePointAt(k) == ch
is true. In either case, if no such character occurs in this string, then -1 is returned. The String is searched backwards starting at the last character.
Parameters:
ch - a character (Unicode code point).
Returns:
the index of the last occurrence of the character in the character sequence represented by this object, or -1 if the character does not occur.
Aber ich verstehe nicht wie ich die Codes in meinen Quellcode einbaue.
Könnte jemand bitte ein Beispiel geben mit z.B.: lastIndexOf
Das steht auf der Seite darüber:
lastIndexOf
public int lastIndexOf(int ch)
Returns the index within this string of the last occurrence of the specified character. For values of ch in the range from 0 to 0xFFFF (inclusive), the index (in Unicode code units) returned is the largest value k such that:
this.charAt(k) == ch
is true. For other values of ch, it is the largest value k such that:
this.codePointAt(k) == ch
is true. In either case, if no such character occurs in this string, then -1 is returned. The String is searched backwards starting at the last character.
Parameters:
ch - a character (Unicode code point).
Returns:
the index of the last occurrence of the character in the character sequence represented by this object, or -1 if the character does not occur.