PR2Bibliothek/ki-chatgpt/ki3.txt

14 lines
526 B
Plaintext
Raw Normal View History

2024-11-18 09:05:33 +01:00
prompt:
how to get the last part of the string fjwaifa.fwwafaw.buch
antwort:
To get the last part of the string "fjwaifa.fwwafaw.buch" in many programming languages, you can split the string by the dot (".") and access the last element.
java
Code kopieren
String string = "fjwaifa.fwwafaw.buch";
String[] parts = string.split("\\.");
String lastPart = parts[parts.length - 1];
System.out.println(lastPart); // Output: buch
The code splits the string into parts at each "." and retrieves the last element, which is "buch".