gpt4 book ai didi

Java 字符串 : how do I get the value of X, Y 和 Z 来自字符串 "vt X,Y,Z"

转载 作者:行者123 更新时间:2023-12-03 05:12:22 25 4
gpt4 key购买 nike

如何从字符串“vt X,Y,Z”中获取 X、Y 和 Z 的值

最佳答案

只要格式保持简单,我就会使用

String s = "vt X, Y, Z";
String[] values = s.split("[ ,]+");
String x = values[1];
String y = values[2];
String z = values[3];

如果格式具有更大的灵 active ,您将需要考虑使用正则表达式(Pattern 类)或使用 ANTLR 等为其创建解析器

关于Java 字符串 : how do I get the value of X, Y 和 Z 来自字符串 "vt X,Y,Z",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/738791/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com