字符串替换和文件处理库
问题描述:
我已经看到了这个* String Replace and File Handling库*,但是我不知道如何使用该源代码,因为它在C-sharp中.
我需要相同的要求,如果可以的话,您可以提供Java的源代码吗?
预先感谢,
madhavan
Hi,
I have seen this *String Replace and File Handling library* but I dont know how to use that source, because it was in C-sharp.
I need the same requirement, if possible can you provide me the source in Java?
Thanks in advance,
madhavan
答
我已经看过该项目中的代码,为了残酷,最好编写自己的库.
您的问题过于笼统,无法回答问题与解答,因此,我将通过提供一些指导来帮助您:
预先确定您想要什么.
如果要修改文件内容,请查看StreamReader
或StreamWriter
,它们将接收流并应用基于规则的转换.
如果您需要搜索/替换字符串中的大量文本,请不要使用String
对象.创建一个StringBuilder
,进行操作然后转换回去.您需要的所有功能都应该是String
或StringBuilder
中的本机.
I''ve looked at the code in that project and to be brutal, you''ll be better off writing your own library.
Your queistion is too broad for a Q&A answer, so I''ll help by giving some pointers:
Decide up front what you want.
If it is to amend file content then look at aStreamReader
orStreamWriter
that will take the stream and apply rule based conversions.
If you need to search/replace a lot of text in strings DO NOT USEString
objects. Create aStringBuilder
, manipulate then convert back. All the fiunctionality you need should be native in eitherString
orStringBuilder
.