简单东西-String的format
来源:互联网 发布:mac桌面保护程序闪退 编辑:程序博客网 时间:2024/05/21 06:50
Java的String类的静态方法format可以完成对字符串的格式化,在web应用中替换请求路径中的参数信息时可以使用
这个简单的函数。
使用format比我以前用String的replace来替换参数,高明多了。
简单代码如下:
public class StringTest {public static void main(String[] args) {String requestPath = "http://localhost:8080/mini_web/user=%s&password=%s";requestPath = String.format(requestPath, "wang","****");System.out.println("requestPath :"+requestPath);}}
测试结果:
requestPath :http://localhost:8080/mini_web/user=wang&password=****
0 0
- 简单东西-String的format
- string.format的简单应用
- String format的简单用法
- string.format的使用
- String.format()的使用方法
- string.Format的用法
- String.format()的使用方法
- String.Format() 的用法
- String.Format()的用法
- java的string format
- String.format()的用法
- String.format 的使用
- c#的String.Format
- String.format()的用法
- String.format()的用法
- String format的使用
- String.format()的用法
- String.format()的格式化
- 为UIToolBar添加按钮,并调整按钮位置
- EXTJS4.x grid编辑出现的问题
- POJ2689_Prime Distance【素数】【两次筛法】
- Android Audio getMinBufferSize
- 项目感受之Easyui tabs的herf和content属性
- 简单东西-String的format
- 黑马程序员-java注意事项
- Android+Audio+相关类
- js页面跳转 和 js打开新窗口 方法
- opensips/kamailio gdb代码调试方法详解
- linux中的cp命令
- 二叉树的创建和前序,中序,后序遍历
- 自定义Visual Assist X Snippets 宏
- Android 横竖屏检测