fork download
  1. class Main {
  2.  
  3. public static void main(String[] args) {
  4. String input = "(🥦) Salad";
  5. String result = unicodeSubstring(input, 1, 2);
  6. System.out.println(result);
  7. }
  8.  
  9. public static String unicodeSubstring(String string, int beginIndex, int endIndex) {
  10. int length = endIndex - beginIndex;
  11. int[] codePoints = string.codePoints()
  12. .skip(beginIndex)
  13. .limit(length)
  14. .toArray();
  15. return new String(codePoints, 0, codePoints.length);
  16. }
  17. }
Success #stdin #stdout 0.09s 48632KB
stdin
Standard input is empty
stdout
🥦