call the following method like this
String_Util.replace(value,"'","''");

  public static String replace(String oldString, String toReplace, String
replaceWith)
  {
    if(toReplace==null || toReplace.equals("") || oldString==null ||
oldString.equals("") || replaceWith==null)
      return oldString;
    StringBuffer sb=new StringBuffer();
    int oldIndex=0;
    int newIndex=0;
    while((newIndex=oldString.indexOf(toReplace,oldIndex))!=-1)
    {
      sb.append(oldString.substring(oldIndex,newIndex));
      sb.append(replaceWith);
      oldIndex=newIndex=newIndex+toReplace.length();
    }
    sb.append(oldString.substring(oldIndex,oldString.length()));
    return sb.toString();
  }

michael

Reply via email to