有没有这样的软件? 有一位先人曾经用过一个,还是国人写的,可是我找不到。他说名字好像叫什么javacodefast之类的。我找了一个下午,毫无收获!希望有这方面信息的提供一下。谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 自己动手写了一个java的程序,不过那位先人说那个程序不只这一个功能,我想是不是CGI或者PHP的什么小软件,里面的功能正好可以满足我所要求的功能。自己写的这个还很幼稚,在我的机器上没有中文问题(不包括文件名)。没有任何的界面,谁有兴趣做一个了。import java.io.*;class HtmltoServlet { HtmltoServlet(String inputfile,String outputfile) { try { BufferedInputStream in = new BufferedInputStream( new FileInputStream( inputfile)); PrintStream out = new PrintStream( new BufferedOutputStream( new FileOutputStream(outputfile))); System.setIn(in); System.setOut(out); System.setErr(out); BufferedReader br = new BufferedReader( new InputStreamReader(System.in)); String s; while((s = br.readLine()) != null) { String temp=""; int current = -1; int end = 0; try { end = s.indexOf("\"",current+1); /*----------------- parse ----------*/ while(end!=-1){ String value = s.substring(current+1,end); current = s.indexOf("\"",end); end = s.indexOf("\"",current+1); temp = temp + value +"\\\"" ; } { String value = s.substring(current+1,s.length()); temp = temp + value; } }catch(Exception e){ e.printStackTrace(); } System.out.println("out.println(\""+temp+"\");"); } out.close(); } catch(IOException e) { System.out.println(e); e.printStackTrace(); } } public static void main(String[] args) { if (args.length!=2) { System.out.println("java cuteText <inputfile fullname> <outputfile fullname>"); System.exit(0); } HtmltoServlet hts = new HtmltoServlet(args[0],args[1]); }} 使用StringBuffer的replace方法更省事 很久没有上来了。replace只能char到char,我怎么把"换成\"呢? 还有一个非常有意是的问题,下面是两个转换程序h2s.java和h2s_2.java:h2s.java文件为:import java.io.*;class h2s { h2s_2(String inputfile,String outputfile) { try { BufferedInputStream in = new BufferedInputStream( new FileInputStream( inputfile)); PrintStream out = new PrintStream( new BufferedOutputStream( new FileOutputStream(outputfile))); System.setIn(in); System.setOut(out); System.setErr(out); BufferedReader br = new BufferedReader( new InputStreamReader(System.in)); String s=""; while((s = br.readLine()) != null) { String temp=""; int current = -1; int end = 0; s = s.trim(); try { end = s.indexOf("\"",current+1); /*----------------- parse ----------*/ while(end!=-1){ String value = s.substring(current+1,end); current = s.indexOf("\"",end); end = s.indexOf("\"",current+1); temp = temp + value +"\\\"" ; } { String value = s.substring(current+1,s.length()); temp = temp + value; } }catch(Exception e){ e.printStackTrace(); } if (!temp.equals("")) System.out.println("out.println(\""+temp+"\");"); } out.close(); } catch(IOException e) { System.out.println(e); e.printStackTrace(); } } public static void main(String[] args) { if (args.length!=2) { System.out.println("java h2s <inputfile fullname> <outputfile fullname>"); System.exit(0); } h2s hts = new h2s(args[0],args[1]); }} h2s_2.java文件为:import java.io.*;class h2s_2 { h2s_2(String inputfile,String outputfile) { try { BufferedInputStream in = new BufferedInputStream( new FileInputStream( inputfile)); PrintStream out = new PrintStream( new BufferedOutputStream( new FileOutputStream(outputfile))); System.setIn(in); System.setOut(out); System.setErr(out); BufferedReader br = new BufferedReader( new InputStreamReader(System.in)); String s=""; while((s = br.readLine().trim()) != null) { String temp=""; int current = -1; int end = 0; try { end = s.indexOf("\"",current+1); /*----------------- parse ----------*/ while(end!=-1){ String value = s.substring(current+1,end); current = s.indexOf("\"",end); end = s.indexOf("\"",current+1); temp = temp + value +"\\\"" ; } { String value = s.substring(current+1,s.length()); temp = temp + value; } }catch(Exception e){ e.printStackTrace(); } if (!temp.equals("")) System.out.println("out.println(\""+temp+"\");"); } out.close(); } catch(IOException e) { System.out.println(e); e.printStackTrace(); } } public static void main(String[] args) { if (args.length!=2) { System.out.println("java h2s_2 <inputfile fullname> <outputfile fullname>"); System.exit(0); } h2s_2 hts = new h2s_2(args[0],args[1]); }} 一道SCJP的题目 如何用java绘制弧形文字(急!!!!!) 请问谁有做过SNMP的简单网管软件,或者毕业设计,要当毕业设计的。 JAVA 初学者 高手给点意见 如何导入自己的类?? java 的无符号整型 求inside the java virtual machine(英文版)的下载地址. 关于TreeTable的问题 Linux下如何用系统默认的浏览器打开网页? 请教:如何在JAVA中调用telnet程序?谢谢 :) 请各位大侠帮帮忙,如何取的鼠标点击处的颜色值???? 现在颇多无聊,只好考试度日
自己写的这个还很幼稚,在我的机器上没有中文问题(不包括文件名)。没有任何的界面,谁有兴趣做一个了。
import java.io.*;class HtmltoServlet { HtmltoServlet(String inputfile,String outputfile) {
try {
BufferedInputStream in =
new BufferedInputStream(
new FileInputStream(
inputfile));
PrintStream out =
new PrintStream(
new BufferedOutputStream(
new FileOutputStream(outputfile)));
System.setIn(in);
System.setOut(out);
System.setErr(out); BufferedReader br =
new BufferedReader(
new InputStreamReader(System.in));
String s;
while((s = br.readLine()) != null)
{
String temp="";
int current = -1;
int end = 0; try
{
end = s.indexOf("\"",current+1);
/*----------------- parse ----------*/
while(end!=-1){
String value = s.substring(current+1,end);
current = s.indexOf("\"",end);
end = s.indexOf("\"",current+1);
temp = temp + value +"\\\"" ;
}
{
String value = s.substring(current+1,s.length());
temp = temp + value;
}
}catch(Exception e){
e.printStackTrace();
}
System.out.println("out.println(\""+temp+"\");");
}
out.close();
} catch(IOException e) {
System.out.println(e);
e.printStackTrace();
}
} public static void main(String[] args) { if (args.length!=2)
{
System.out.println("java cuteText <inputfile fullname> <outputfile fullname>");
System.exit(0);
}
HtmltoServlet hts = new HtmltoServlet(args[0],args[1]); }
}
replace只能char到char,我怎么把"换成\"呢?
h2s.java文件为:
import java.io.*;
class h2s {
h2s_2(String inputfile,String outputfile) {
try {
BufferedInputStream in =
new BufferedInputStream(
new FileInputStream(
inputfile));
PrintStream out =
new PrintStream(
new BufferedOutputStream(
new FileOutputStream(outputfile)));
System.setIn(in);
System.setOut(out);
System.setErr(out); BufferedReader br =
new BufferedReader(
new InputStreamReader(System.in));
String s="";
while((s = br.readLine()) != null)
{
String temp="";
int current = -1;
int end = 0;
s = s.trim(); try
{
end = s.indexOf("\"",current+1);
/*----------------- parse ----------*/
while(end!=-1){
String value = s.substring(current+1,end);
current = s.indexOf("\"",end);
end = s.indexOf("\"",current+1);
temp = temp + value +"\\\"" ;
}
{
String value = s.substring(current+1,s.length());
temp = temp + value;
}
}catch(Exception e){
e.printStackTrace();
}
if (!temp.equals(""))
System.out.println("out.println(\""+temp+"\");");
}
out.close();
} catch(IOException e) {
System.out.println(e);
e.printStackTrace();
}
} public static void main(String[] args) { if (args.length!=2)
{
System.out.println("java h2s <inputfile fullname> <outputfile fullname>");
System.exit(0);
}
h2s hts = new h2s(args[0],args[1]);
}
}
try {
BufferedInputStream in =
new BufferedInputStream(
new FileInputStream(
inputfile));
PrintStream out =
new PrintStream(
new BufferedOutputStream(
new FileOutputStream(outputfile)));
System.setIn(in);
System.setOut(out);
System.setErr(out); BufferedReader br =
new BufferedReader(
new InputStreamReader(System.in));
String s="";
while((s = br.readLine().trim()) != null)
{
String temp="";
int current = -1;
int end = 0; try
{
end = s.indexOf("\"",current+1);
/*----------------- parse ----------*/
while(end!=-1){
String value = s.substring(current+1,end);
current = s.indexOf("\"",end);
end = s.indexOf("\"",current+1);
temp = temp + value +"\\\"" ;
}
{
String value = s.substring(current+1,s.length());
temp = temp + value;
}
}catch(Exception e){
e.printStackTrace();
}
if (!temp.equals(""))
System.out.println("out.println(\""+temp+"\");");
}
out.close();
} catch(IOException e) {
System.out.println(e);
e.printStackTrace();
}
} public static void main(String[] args) { if (args.length!=2)
{
System.out.println("java h2s_2 <inputfile fullname> <outputfile fullname>");
System.exit(0);
}
h2s_2 hts = new h2s_2(args[0],args[1]); }
}