help! string format???# Java - 爪哇娇娃l*t2003-07-02 07:071 楼urgent!how to output the first 5 letters to a file from a 20-letter string?thank you!!!
xt2003-07-02 07:072 楼OutputStream out = ...;String str = ...;byte[] b = str.getBytes();out.write( b, 0, 5 );【在 l**t 的大作中提到】: urgent!: how to output the first 5 letters to a file from a 20-letter string?: thank you!!!
c*t2003-07-02 07:073 楼why not using substring?【在 xt 的大作中提到】: : OutputStream out = ...;: String str = ...;: byte[] b = str.getBytes();: out.write( b, 0, 5 );
m*c2003-07-02 07:074 楼String str20 = ...;Writer writer = new BufferedWriter(new FileWriter(new File(...)));write.write (str20, 0, 5); // cannot remember it should 4 or 5writer.close();【在 c*****t 的大作中提到】: why not using substring?
st2003-07-02 07:075 楼~~~~~~~~no need tonest one more bah.BufferedWriter w=new BufferedWriter(new FileWriter("filename")); should work.【在 m**c 的大作中提到】: : String str20 = ...;: Writer writer = new BufferedWriter(new FileWriter(new File(...)));: write.write (str20, 0, 5); // cannot remember it should 4 or 5: writer.close();
c*t2003-07-02 07:076 楼ffdt, usestr20.substring (0, 5)【在 m**c 的大作中提到】: : String str20 = ...;: Writer writer = new BufferedWriter(new FileWriter(new File(...)));: write.write (str20, 0, 5); // cannot remember it should 4 or 5: writer.close();