If I have a URL String but one part is dynamic should I break it in two or can I insert a variable in the middle?

I’m trying to build a URL that I’ll use in a POST request. The completed URL will look something like this:

http://somesite.com/post/member/{AccountNumber}/verify/etc

The AccountNumber will be dynamic.

That can be done easily enough by having something like this:

String PATH1 = "http://somesite.com/post/member/"
String PATH2 = "/verify/etc"
String accountNumber;     //set account Number somewhere in the code

public String buildURL(String path1, String path2, String accoundNumber) {
    String url = path1 + accountNumber + path2
    return url;
}

I was wondering if I could do this more cleanly by having just one PATH. I’d like to read in the path from a yml or properties file and then dynamically insert the AccountNumber. Is it possible to do this?

So, my buildURL would look something like this:

String PATH = http://somesite.com/post/member/{AccountNumber}/verify/etc
String accountNumber;     //set account Number somewhere in the code

public String buildURL(String path, String accoundNumber) {
    String url = path{insert AccountNumber somehow}
    return url;
}

Or should I just stick with breaking it in two (I am overthinking this?)? Thanks.

EDIT: I realize I may have misused some terms. Not 100$ sure if it should be called ‘PATH1’, ‘PATH2’ etc since after looking here: What is the name of this URL part?
it seems like I’m including the ‘scheme’ and ‘authority’ part of the URL as PATH1.