apkfuckery/com.discord/smali/androidx/room/util/StringUtil.smali
2019-08-30 22:04:20 +02:00

215 lines
4.5 KiB
Smali

.class public Landroidx/room/util/StringUtil;
.super Ljava/lang/Object;
.source "StringUtil.java"
# static fields
.field public static final EMPTY_STRING_ARRAY:[Ljava/lang/String;
# direct methods
.method static constructor <clinit>()V
.locals 1
const/4 v0, 0x0
new-array v0, v0, [Ljava/lang/String;
sput-object v0, Landroidx/room/util/StringUtil;->EMPTY_STRING_ARRAY:[Ljava/lang/String;
return-void
.end method
.method private constructor <init>()V
.locals 0
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method public static appendPlaceholders(Ljava/lang/StringBuilder;I)V
.locals 2
const/4 v0, 0x0
:goto_0
if-ge v0, p1, :cond_1
const-string v1, "?"
invoke-virtual {p0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
add-int/lit8 v1, p1, -0x1
if-ge v0, v1, :cond_0
const-string v1, ","
invoke-virtual {p0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
:cond_0
add-int/lit8 v0, v0, 0x1
goto :goto_0
:cond_1
return-void
.end method
.method public static joinIntoString(Ljava/util/List;)Ljava/lang/String;
.locals 4
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/util/List<",
"Ljava/lang/Integer;",
">;)",
"Ljava/lang/String;"
}
.end annotation
if-nez p0, :cond_0
const/4 p0, 0x0
return-object p0
:cond_0
invoke-interface {p0}, Ljava/util/List;->size()I
move-result v0
if-nez v0, :cond_1
const-string p0, ""
return-object p0
:cond_1
new-instance v1, Ljava/lang/StringBuilder;
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
const/4 v2, 0x0
:goto_0
if-ge v2, v0, :cond_3
invoke-interface {p0, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;
move-result-object v3
check-cast v3, Ljava/lang/Integer;
invoke-virtual {v3}, Ljava/lang/Integer;->intValue()I
move-result v3
invoke-static {v3}, Ljava/lang/Integer;->toString(I)Ljava/lang/String;
move-result-object v3
invoke-virtual {v1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
add-int/lit8 v3, v0, -0x1
if-ge v2, v3, :cond_2
const-string v3, ","
invoke-virtual {v1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
:cond_2
add-int/lit8 v2, v2, 0x1
goto :goto_0
:cond_3
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p0
return-object p0
.end method
.method public static newStringBuilder()Ljava/lang/StringBuilder;
.locals 1
new-instance v0, Ljava/lang/StringBuilder;
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
return-object v0
.end method
.method public static splitToIntList(Ljava/lang/String;)Ljava/util/List;
.locals 4
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/lang/String;",
")",
"Ljava/util/List<",
"Ljava/lang/Integer;",
">;"
}
.end annotation
if-nez p0, :cond_0
const/4 p0, 0x0
return-object p0
:cond_0
new-instance v0, Ljava/util/ArrayList;
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
new-instance v1, Ljava/util/StringTokenizer;
const-string v2, ","
invoke-direct {v1, p0, v2}, Ljava/util/StringTokenizer;-><init>(Ljava/lang/String;Ljava/lang/String;)V
:goto_0
invoke-virtual {v1}, Ljava/util/StringTokenizer;->hasMoreElements()Z
move-result p0
if-eqz p0, :cond_1
invoke-virtual {v1}, Ljava/util/StringTokenizer;->nextToken()Ljava/lang/String;
move-result-object p0
:try_start_0
invoke-static {p0}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I
move-result p0
invoke-static {p0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object p0
invoke-interface {v0, p0}, Ljava/util/List;->add(Ljava/lang/Object;)Z
:try_end_0
.catch Ljava/lang/NumberFormatException; {:try_start_0 .. :try_end_0} :catch_0
goto :goto_0
:catch_0
move-exception p0
const-string v2, "ROOM"
const-string v3, "Malformed integer list"
invoke-static {v2, v3, p0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
goto :goto_0
:cond_1
return-object v0
.end method