常用方法:
split("")以字符分隔产生数组(可以是int,string,char,double,float);
replace(old char,new char)用来替换字符串中一定的字符;
toString()转化为字符串类型
separator()方法代表盘符的分隔路径的分隔符
BufferedReader reader = new BufferedReader(new InputStreamReader(InputStream is))注:括号中的InputStream is是InputStream的实例化对象
currentTimeMillis()获取当前时间:
Scanner sc = new Scanner(System.in);
int i = sc.nextInt();从当前输入中获取一个整数
hasNext()方法用于判断是否有等待输入的内容,如果有,返回true,反之返回flase
next()用于扫描下一个输入的数据,返回字符串类型,调用next方法后,指针指向下一个地址
line.startWith("")判断当前行是否以指定的字符开始
String.format(template(模板),words(对应的模板的字符串))
乱码转换:
String n
new String( n .getBytes("iso-8859-1"),"utf-8")
判断当前文件是否存在,不存在创建文件夹,然后将文件写入次文件夹;
File file = new File(fileName);
if (!file.exists()){
file.getParentFile().mkdirs();
}
file.getParentFile()用于获取当前文件的父目录,然后创建当前父目录
substring(int a,int b ),截取字符串中下标为a-b的字符
重载的返回值类型可以被改变。
String temple="%s,%s,%s";
String.format (temple,shuzu)使用指定的格式字符串和参数返回一个格式化字符串。
<jsp:include url="",flush="true">将制定的页面包含到当前页面中,
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒");
将时间以制定的格式输出System.out.println(sdf1.format(now) )
使用parse()方法将文本转换为日期
sdf1.parse(now)
split("")以字符分隔产生数组(可以是int,string,char,double,float);
replace(old char,new char)用来替换字符串中一定的字符;
toString()转化为字符串类型
separator()方法代表盘符的分隔路径的分隔符
BufferedReader reader = new BufferedReader(new InputStreamReader(InputStream is))注:括号中的InputStream is是InputStream的实例化对象
currentTimeMillis()获取当前时间:
Scanner sc = new Scanner(System.in);
int i = sc.nextInt();从当前输入中获取一个整数
hasNext()方法用于判断是否有等待输入的内容,如果有,返回true,反之返回flase
next()用于扫描下一个输入的数据,返回字符串类型,调用next方法后,指针指向下一个地址
line.startWith("")判断当前行是否以指定的字符开始
String.format(template(模板),words(对应的模板的字符串))
乱码转换:
String n
new String( n .getBytes("iso-8859-1"),"utf-8")
判断当前文件是否存在,不存在创建文件夹,然后将文件写入次文件夹;
File file = new File(fileName);
if (!file.exists()){
file.getParentFile().mkdirs();
}
file.getParentFile()用于获取当前文件的父目录,然后创建当前父目录
substring(int a,int b ),截取字符串中下标为a-b的字符
重载的返回值类型可以被改变。
String temple="%s,%s,%s";
String.format (temple,shuzu)使用指定的格式字符串和参数返回一个格式化字符串。
<jsp:include url="",flush="true">将制定的页面包含到当前页面中,
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒");
将时间以制定的格式输出System.out.println(sdf1.format(now) )
使用parse()方法将文本转换为日期
sdf1.parse(now)