From a7722ba00a947a0a47ede9ecfb1b618dc52e6497 Mon Sep 17 00:00:00 2001 From: Stefan Murawski Date: Mon, 25 Dec 2023 18:29:24 +0100 Subject: [PATCH] Split with StringUtils and not Regex --- project/build.gradle | 1 + project/src/main/java/com/shurik/droidzebra/ZebraEngine.java | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/project/build.gradle b/project/build.gradle index 3e4baee..8bc9693 100644 --- a/project/build.gradle +++ b/project/build.gradle @@ -84,6 +84,7 @@ dependencies { implementation 'androidx.vectordrawable:vectordrawable-animated:1.1.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'com.github.matomo-org:matomo-sdk-android:4.1.4' + implementation 'org.apache.commons:commons-lang3:3.0' implementation 'com.github.Innovattic:range-seek-bar:v1.0.6' implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0")) diff --git a/project/src/main/java/com/shurik/droidzebra/ZebraEngine.java b/project/src/main/java/com/shurik/droidzebra/ZebraEngine.java index fb1a0bd..075ab16 100644 --- a/project/src/main/java/com/shurik/droidzebra/ZebraEngine.java +++ b/project/src/main/java/com/shurik/droidzebra/ZebraEngine.java @@ -18,6 +18,8 @@ package com.shurik.droidzebra; import android.util.Log; + +import org.apache.commons.lang3.StringUtils; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -714,7 +716,8 @@ private JSONObject Callback(int msgcode, JSONObject data) { case MSG_STATUS: { String message = data.getString("status"); ZebraEngine.this.onDebugListener.onDebug("Status: " + message); - String[] split = message.split("\\s+"); + + String[] split = StringUtils.split(message, ' '); if(split.length > 1) { String reachedDepth = split[1]; ZebraEngine.this.onDebugListener.onDebug("Depth: " + reachedDepth);