在Java中的相对路径中插入字符串

时间:2016-05-20 16:18:27

标签: java filepath

我的路径如下

Application1.app.back();
上述路径中的

ConfigFactory oConfig = new ConfigFactory(sBaseUrl, "abc", "12345", "/u/toy/apps/JETTY/instances/US_32970_test/pop-mm_3.0.201/config" ); 应来自32970

如何在路径中追加Queue的值

2 个答案:

答案 0 :(得分:4)

使用String.format(String, Object...)

String.format(
    "/u/toy/apps/JETTY/instances/US_%s_test/pop-mm_3.0.201/config",
    Queue)

答案 1 :(得分:0)

Concat the String:

"/u/toy/apps/JETTY/instances/US_" + Queue + "_test/pop-mm_3.0.201/config"