example call eregi_replace("\r\n | \r | \n | \n\r", "", strResult);
public String eregi_replace(String strFrom, String strTo, String strTarget)
{
String strPattern = "(?i)" + strFrom;
Pattern p = Pattern.compile(strPattern);
Matcher m = p.matcher(strTarget);
if(m.find())
{
return strTarget.replaceAll(strFrom, strTo);
}
else
{
return strTarget;
}
}
沒有留言:
張貼留言