- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
public static String cutN(String s,int n) {
char [] chars = s.toCharArray();
String result = "";
if (chars.length<n) throw new RuntimeException();
for (int l=0; l<n;l++) {
result += chars[l];
}
return result;
}