0

I have a path as below

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

32970 in the above path should come from String Queue = "32930"

How can i append value of Queue in the path

1
  • You can't append into the middle of the string. As the name suggests, append adds to the end. You just need the string concatenation, what's pretty elementary operation in the programming. Commented May 23, 2016 at 17:19

2 Answers 2

4

Use String.format(String, Object...):

String.format(
    "/u/toy/apps/JETTY/instances/US_%s_test/pop-mm_3.0.201/config",
    Queue)
Sign up to request clarification or add additional context in comments.

2 Comments

and if US_32970_test is only one file in the path always which always changes name, how can we use something like /../ . I used /u/toy/apps/JETTY/instances/..t/pop-mm_3.0.201/config but it doesn't work
can anyone help here
0

Concat the String:

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

1 Comment

But US_" + Queue + "_test value keeps on changing and i want to put something like "/u/toy/apps/JETTY/instances/../pop-mm_3.0.201/config" , but it doesn't accepts .. any idea will be appreciated

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.