【发布时间】:2014-02-08 05:05:24
【问题描述】:
int x1;
int y1;
int x2;
int y2;
String shape = " sequenceNumber <Square> 50 60 70 90 </Square> "
public splitThem(String s){
//I can't figure out how to extract the information i need...
//... Do sometthing to extract splitThem(shape)
int this.x1 = parseString("50");
int this.y1 = parseString("60");
int this.x2 = parseString("70");
int this.y2 = parseString("90");
}
public void Graphics(graphic g){
g.drawRect(x1,y1,x2,y2);
}
我想知道是否有办法提取我需要的信息并将它们解析为整数???类似于拆分方法??
【问题讨论】:
-
形状的字符串——它来自哪里——真的是那样吗,它是 XML 的一部分吗?你有什么东西可以正式定义它是什么吗?
-
我要手动输入
-
但我还没到那里.. 我要做的是输入格式
x y x y -
然后我需要一些函数来提取我输入的内容并将它们放入变量中并绘制形状
-
像 XML 但不是 XML?
标签: java string split int shape