strrequest


<%!
 private String strrequest(String input){//返回big5码/并将特殊符号转化
 if(input!=null){
 
   try   {

   //  public static String replaceHTML(String input)
 char ch=' ';
 StringBuffer buf=new StringBuffer(input.length()+6);
 if(input==null || input.length()==0)return input;
 for(int i=0 ;i<input.length(); i++){
  ch=input.charAt(i); 
   if(ch=='<')buf.append("&lt;");
  else if(ch=='>')buf.append("&gt;");
  else if(ch=='/'')buf.append("&acute;");
  else if(ch=='/"')buf.append("&quot;");
  //else if(ch==' ')buf.append("&nbsp;");
  else
   buf.append(ch);
 }
 input=buf.toString();

     byte[] b_inputtemp=input.getBytes("ISO8859_1");
  String temp=new String(b_inputtemp,"big5");
     return temp;
   }
   catch(Exception e){ 
     return input;
  }
}
else
return "";
}

 private String toGBK(String input){//返回big5码/并将特殊符号转化
 if(input!=null){
 
   try   {

   //  public static String replaceHTML(String input)
 char ch=' ';
 StringBuffer buf=new StringBuffer(input.length()+6);
 if(input==null || input.length()==0)return input;
 for(int i=0 ;i<input.length(); i++){
  ch=input.charAt(i); 
   if(ch=='<')buf.append("&lt;");
  else if(ch=='>')buf.append("&gt;");
  else if(ch=='/'')buf.append("&acute;");
  else if(ch=='/"')buf.append("&quot;");
  //else if(ch==' ')buf.append("&nbsp;");
  else
   buf.append(ch);
 }
 input=buf.toString();

     byte[] b_inputtemp=input.getBytes("iso8859-1");
  String temp=new String(b_inputtemp,"gbk");
     return temp;
   }
   catch(Exception e){ 
     return input;
  }
}
else
return "";
}

 private String toUTF(String input){//返回utf-8码/并将特殊符号转化
 if(input!=null){
 
   try   {

   //  public static String replaceHTML(String input)
 char ch=' ';
 StringBuffer buf=new StringBuffer(input.length()+6);
 if(input==null || input.length()==0)return input;
 for(int i=0 ;i<input.length(); i++){
  ch=input.charAt(i); 
   if(ch=='<')buf.append("&lt;");
  else if(ch=='>')buf.append("&gt;");
  else if(ch=='/'')buf.append("&acute;");
  else if(ch=='/"')buf.append("&quot;");
  //else if(ch==' ')buf.append("&nbsp;");
  else
   buf.append(ch);
 }
 input=buf.toString();

     byte[] b_inputtemp=input.getBytes("iso8859-1");
  String temp=new String(b_inputtemp,"utf-8");
     return temp;
   }
   catch(Exception e){ 
     return input;
  }
}
else
return "";
}

private String str(String input){
 if(input!=null && !input.equals("")){
  char ch=' ';
 input=input.trim();
 StringBuffer buf=new StringBuffer(input.length()+6);
 if(input==null || input.length()==0)return input;
 for(int i=0 ;i<input.length(); i++){
  ch=input.charAt(i);
  // if(ch==13) buf.append("<br>");//回車鍵
   if(ch=='<')buf.append("&lt;");
  else if(ch=='>')buf.append("&gt;");
  else if(ch=='/'')buf.append("&acute;");
  else if(ch=='/"')buf.append("&quot;");
  //else if(ch==' ')buf.append("&nbsp;");
  else
   buf.append(ch);
 }
 input=buf.toString();
 return input;
 }
 else
return "";
}

private String  nstr(String input){
 if(input!=null && !input.equals("")){
   return input;
 }
 else
return "";
}

private String replacemonth(String input){

try{

return input;
}catch (Exception e){ return "";}
}

private String strhtml(String input){
if(input!=null || !input.equals("")){
 try   {
     byte[] b_inputtemp=input.getBytes("8859_1");
     String temp=new String(b_inputtemp,"big5");
     return temp;
   }catch(Exception e){ 
    return input;
   }
}
else
return "";
}

//格式化两位小数,从字符数字返回字符数字
private String numberformat(String input){
java.text.DecimalFormat formatter = new java.text.DecimalFormat("0.00");
try{
if(input!=null &&  !input.equals("") && Double.parseDouble(input)>=0 )
input=formatter.format(Double.parseDouble(input));
else
input="0.00";
return input;
}catch (Exception e){ return "0.00";}
}

private String numberformat_3(String input){
java.text.DecimalFormat formatter = new java.text.DecimalFormat("0.000");
try{
if(input!=null &&  !input.equals("") && Double.parseDouble(input)>=0 )
input=formatter.format(Double.parseDouble(input));
else
input="0.000";
return input;
}catch (Exception e){ return "0.000";}
}
//get current date
private String currentDate(String dateformat){
String strDate="";
if(dateformat!=null && dateformat.equals("long")){
java.text.SimpleDateFormat lformatter = new java.text.SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
java.util.Date  dDate=new java.util.Date();
 strDate=lformatter.format(dDate);
 }else {
 java.text.SimpleDateFormat sformatter = new java.text.SimpleDateFormat("yyyy-MM-dd");
 java.util.Date  dDate=new java.util.Date();
 strDate=sformatter.format(dDate);
 }
return strDate;
}


private  String crtoB(String strCon) {

   int SPos = 0; //开始位置
   int EPos = 0; //设定结束位置
   int totallen = strCon.length();//取得字符长度
   String strShow = "";//起始设定显示字符
   String strMid = "";

     for(EPos=0;EPos<totallen;EPos++) {

     char c = strCon.charAt(EPos);

     if(c==13) //判断是否为复位字元

     {
       if(EPos!=SPos) {

         strMid = strCon.substring(SPos,EPos);
         strShow = strShow + strMid + "<br>";

       }
          else {

          strShow = strShow + " ";

       }
         SPos = EPos +2;//将SPos所指向位置向后移动两个字元

        }//c==13

       }//end for

      if(SPos<EPos){ //判断是否有剩余的字符

         strMid =strCon.substring(SPos,EPos);
         strShow = strShow +strMid +" ";
      }

      return strShow; //回传strShow变数.

   }
  
   public static String convertn(String rStr, String rFix, String rRep){
 int l = 0;
 String gRtnStr = rStr;
 do{
  l = rStr.indexOf(rFix,l);
  if(l == -1) break;
  gRtnStr = rStr.substring(0,l) + rRep + rStr.substring(l + rFix.length());
  l += rRep.length();
  rStr = gRtnStr;
  }while(true);
  return gRtnStr.substring(0, gRtnStr.length());
  }
%>
<script lanugage=javascript>
//给字符串加去空格函数
String.prototype.Trim = function()
{
return this.replace(/(^/s*)|(/s*$)/g, "");
}
function printURI(strUrl)
{

        // var modifywin=window.open(strUrl ,'Print_Setup','menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=1,resizable=2,top=0,left=0,width=300,height=200')
 //  var x = (screen.width-100)/2;
     //   var y = (screen.height-200)/2;
     //   modifywin.moveTo(x, y);
      //  if (modifywin.focus != null)
        //    modifywin.focus();
  //var wndReturn = showModalDialog(strUrl,"","Help=no;status:no;dialogWidth=300px;dialogHeight=200px;scroll=no;");
  var wndReturn = showModalDialog(strUrl,"","Help=no;status:no;dialogWidth=350px;dialogHeight=260px;scroll=no;");
 return String(wndReturn);  
}
function winprint(strUrl,name)
{

         var modifywin=window.open(strUrl , name,'menubar=no,toolbar=1,location=no,directories=no,status=no,scrollbars=1,resizable=1,width=700,top=0,left=0,height=700')
  
}
function winopen(strUrl)
{

         var modifywin=window.open(strUrl ,'openWindow','menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=1,resizable=1,width=700,top=0,left=0,height=700')
  
}
</script>
<STYLE>
       BR.page { page-break-after: always }
</STYLE>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值