unit test & packages

This commit is contained in:
Sage The DM 2025-01-22 15:40:12 +01:00
parent 3e595922e6
commit abe38e8416
14 changed files with 70 additions and 1 deletions

Binary file not shown.

View file

@ -1,5 +1,8 @@
public class App {
public static void main(String[] args) throws Exception {
System.out.println("Hello, World!");
// System.out.println(Txt.Left("Hello World", 5));
// System.out.println(Txt.Left("Hello World", -2));
// System.out.println(Txt.Left("Hello World", 122));
// System.out.println(Txt.Left("Hello World", 0));
}
}

View file

@ -0,0 +1,16 @@
package tech.photofuel.util;
public class Txt {
public static String Left(String text, int anzahlZeichen) {
try {
if (text.length() < anzahlZeichen) {
return text;
} else {
return text.substring(0, anzahlZeichen);
}
} catch (Exception e) {
System.out.println("Invalid input error: " + e);
return null;
}
}
}