Here you can find the source of unicodePreservingSubstring(String paramString, int paramInt1, int paramInt2)
public static String unicodePreservingSubstring(String paramString, int paramInt1, int paramInt2)
//package com.java2s; public class Main { public static String unicodePreservingSubstring(String paramString, int paramInt1, int paramInt2) { int i = unicodePreservingIndex(paramString, paramInt1); int j = unicodePreservingIndex(paramString, paramInt2); return paramString.substring(i, j); }//ww w. ja v a 2 s .co m public static int unicodePreservingIndex(String paramString, int paramInt) { if (paramInt > 0) { int i = paramString.length(); if (paramInt < i) { int j = paramInt + -1; if ((Character.isHighSurrogate(paramString.charAt(j))) && (Character.isLowSurrogate(paramString .charAt(paramInt)))) paramInt += -1; } } return paramInt; } }