[英]Generate octave query using java
I have a complicated drawing procedure written in Octave. 我有一个用Octave编写的复杂绘图程序。 I want to call it from JAVA.
我想用JAVA来称呼它。 So, I am generating some octave query using JAVA to call this
draw
function. 因此,我正在使用JAVA生成一些倍频程查询来调用此
draw
函数。 However, this part of code does not seem to me right: 但是,这部分代码在我看来似乎不正确:
String line = "draw('" + header + "','" + title + "'," + Arrays.toString(y1) + "," + Arrays.toString(y2) + "');";
Here, it is very hard to read because of the '
and "
s. 在这里,这是非常困难的,因为的阅读
'
和"
秒。
Is there any other better way to do it? 还有其他更好的方法吗?
There is! 有! Try
String.format
: 试试
String.format
:
String line = String.format("draw('%s', '%s', '%s', '%s');", header, title, Arrays.toString(y1), Arrays.toString(y2));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.