java 使用String.format进行拼接URL连接地址

public class TestA {

    public static void main(String[] args) {
        String P_UserId = "zhangsan";
        String P_OrderId = "201611101001";
        String P_CardId = "6217230222222222222";
        String P_CardPass = "ICBC";
        String P_FaceValue = "战士";
        String P_ChannelId = "001";
        String P_Subject = "转账";
        String P_Price = "100.0";
        String P_Quantity = "ccc";
        String P_Description = "hanson";
        String P_Notic = "hanson";
        String P_Result_URL = "hanson";
        String P_Notify_URL = "hanson";
        String P_PostKey = "hanson";
        String postUrl = String.format(
                "?P_UserId=%s&P_OrderId=%s&P_CardId=%s&P_CardPass=%s&P_FaceValue=%s&P_ChannelId=%s&P_Subject=%s&P_Price=%s"
                , P_UserId
                , P_OrderId
                , P_CardId
                , P_CardPass
                , P_FaceValue
                , P_ChannelId
                , P_Subject
                , P_Price
        );
        
        System.out.println(postUrl);
        
    }
}
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值