Search in sources :

Example 1 with StringUtils

use of jadx.core.utils.StringUtils in project jadx by skylot.

the class StringUtilsTest method testStringUnescape.

@Test
@SuppressWarnings("AvoidEscapedUnicodeCharacters")
public void testStringUnescape() {
    JadxArgs args = new JadxArgs();
    args.setEscapeUnicode(true);
    stringUtils = new StringUtils(args);
    checkStringUnescape("", "");
    checkStringUnescape("'", "'");
    checkStringUnescape("a", "a");
    checkStringUnescape("\n", "\\n");
    checkStringUnescape("\t", "\\t");
    checkStringUnescape("\r", "\\r");
    checkStringUnescape("\b", "\\b");
    checkStringUnescape("\f", "\\f");
    checkStringUnescape("\\", "\\\\");
    checkStringUnescape("\"", "\\\"");
    checkStringUnescape("\u1234", "\\u1234");
}
Also used : StringUtils(jadx.core.utils.StringUtils) JadxArgs(jadx.api.JadxArgs) Test(org.junit.jupiter.api.Test)

Example 2 with StringUtils

use of jadx.core.utils.StringUtils in project jadx by skylot.

the class StringUtilsTest method testCharUnescape.

@Test
public void testCharUnescape() {
    stringUtils = new StringUtils(new JadxArgs());
    checkCharUnescape('a', "a");
    checkCharUnescape(' ', " ");
    checkCharUnescape('\n', "\\n");
    checkCharUnescape('\'', "\\'");
    assertThat(stringUtils.unescapeChar('\0'), is("0"));
}
Also used : StringUtils(jadx.core.utils.StringUtils) JadxArgs(jadx.api.JadxArgs) Test(org.junit.jupiter.api.Test)

Aggregations

JadxArgs (jadx.api.JadxArgs)2 StringUtils (jadx.core.utils.StringUtils)2 Test (org.junit.jupiter.api.Test)2