字符串替换和文件处理库 [英] String Replace and File Handling library

查看:59
本文介绍了字符串替换和文件处理库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我已经看到了这个* 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

推荐答案

我已经看过该项目中的代码,为了残酷,最好编写自己的库.

您的问题过于笼统,无法回答问题与解答,因此,我将通过提供一些指导来帮助您:

预先确定您想要什么.
如果要修改文件内容,请查看StreamReaderStreamWriter,它们将接收流并应用基于规则的转换.

如果您需要搜索/替换字符串中的大量文本,请不要使用String对象.创建一个StringBuilder,进行操作然后转换回去.您需要的所有功能都应该是StringStringBuilder中的本机.
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 a StreamReader or StreamWriter that will take the stream and apply rule based conversions.

If you need to search/replace a lot of text in strings DO NOT USE String objects. Create a StringBuilder, manipulate then convert back. All the fiunctionality you need should be native in either String or StringBuilder.


这篇关于字符串替换和文件处理库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆