коммит последних действий
This commit is contained in:
@@ -19,3 +19,6 @@ Thumbs.db
|
||||
# Build outputs
|
||||
server/builds/
|
||||
server/logs/
|
||||
|
||||
# Colab
|
||||
colab/
|
||||
Binary file not shown.
@@ -0,0 +1,22 @@
|
||||
public class Test {
|
||||
public static void main(String[] args) {
|
||||
String line = "{\"version\":\"1.0.8\",\"updated_at\":\"2026-05-06T04:38:07\"}";
|
||||
System.out.println("Line: " + line);
|
||||
|
||||
int start = line.indexOf("\"version\":\"");
|
||||
System.out.println("start (version): " + start);
|
||||
|
||||
if (start >= 0) {
|
||||
start += 10;
|
||||
System.out.println("start + 10: " + start);
|
||||
|
||||
int end = line.indexOf("\"", start + 1);
|
||||
System.out.println("end: " + end);
|
||||
|
||||
if (end > start) {
|
||||
String result = line.substring(start, end);
|
||||
System.out.println("Result: [" + result + "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,31 @@
|
||||
public class Test2 {
|
||||
public static void main(String[] args) {
|
||||
String[] tests = {
|
||||
"{\"version\":\"1.0.8\",\"updated_at\":\"2026-05-06T04:38:07\"}",
|
||||
"{\"version\":\"1.0.2\"}",
|
||||
"invalid json"
|
||||
};
|
||||
|
||||
for (String line : tests) {
|
||||
String result = getVersion(line);
|
||||
System.out.println("Input: " + line);
|
||||
System.out.println("Output: [" + result + "]");
|
||||
System.out.println("Length: " + result.length());
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
|
||||
static String getVersion(String line) {
|
||||
if (line != null && line.contains("version")) {
|
||||
int start = line.indexOf("\"version\":\"");
|
||||
if (start >= 0) {
|
||||
start += 10;
|
||||
int end = line.indexOf("\"", start + 1);
|
||||
if (end > start) {
|
||||
return line.substring(start, end);
|
||||
}
|
||||
}
|
||||
}
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
# Maven
|
||||
*/target/
|
||||
target/
|
||||
|
||||
# Build outputs
|
||||
server/builds/
|
||||
server/logs/
|
||||
|
||||
# IDE
|
||||
.idea/
|
||||
*.iml
|
||||
.vscode/
|
||||
|
||||
# OS
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
Reference in New Issue
Block a user