当前位置: 代码迷 >> WHILE的解决方案
 
  • HttpServletResponse 上载代码

    HttpServletResponse下载代码 response.setContentType("application/*"); response.setHeader("Content-Disposition","attachment;filename="+expert2ArticleFile.getYsmc()); OutputStreamos=response.getOutputSt...

    435
    热度
  • javascript写了一个不是用plus的加法演算

    javascript写了一个不是用plus的加法运算 加法是怎么实现的,我们只用进位和比较进行一个简单的实现哈哈,玩一玩 functionadd(a,b){ varop1=a; varop2=b; varc=0;//进位 varret=0;//结果 while(1){ ret=op1^op2; c=op1&op2; if(0==c){ break; } op1=ret; op2=c&l...

    120
    热度
  • 如何用正则去掉重复的项

    怎么用正则去掉重复的项?案例:1,2,3,1,4,3,6,7串是被逗号分开的,想要去掉拥有重复的项目,剩下1,2,3,4,6,7怎么用正则而来实现?谢谢了color='#e78608'>------解决方案-------------------- functionredup(s){ varn=null; do{n=s.replace(/([^,]+),(.*)\1(,|$)/g,&qu...

    81
    热度
  • web运用读取webRoot中的文件

    web应用读取webRoot中的文件 privateStringgetTxT(HttpServletservlet,StringfileName){ Stringresult=""; try{ //D:\apache-tomcat-6.0.18\webapps\web_pro_name\ StringprojectPath=servlet.getServletContext(...

    403
    热度
  • 随碟附送步骤

    随碟附送方法 importjava.text.SimpleDateFormat;importjava.util.ArrayList;importjava.util.Date;importjava.util.List;importjavax.print.attribute.standard.Destination;importjavax.swing.tree.FixedHeightLayoutCac...

    87
    热度
  • textarea行数跟字数的控制

    textarea行数和字数的控制 请参看代码,实现的功能如题: ? <!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.01Transitional//EN"> <html> <head> <title></title> <metahttp-equiv="content-type"content="text/h...

    144
    热度
  • (pojstep1.1.1)poj 1298(直谈式模拟)

    (pojstep1.1.1)poj1298(直叙式模拟)/* *1298_1.cpp * *Createdon:2013年10月5日 *Author:Administrator */ #include<iostream> #include<string> usingnamespacestd; intmain(){ stringstr; while(cin>...

    327
    热度
  • 最牛群 javascript 判断 IE 版本号方法

    最牛javascript判断IE版本号方法 ? var_IE=(function(){ varv=3,div=document.createElement('div'),all=div.getElementsByTagName('i'); while( div.innerHTML='<!--[ifgtIE'+(++v)+']><i></i><![end...

    438
    热度
  • 金额变换

    金额转换 金额转换:如:1324560.87转换为1,324,560.87 <scripttype="text/javascript"> //格式化金额 ???functionformatNum(num,n){//参数说明:num要格式化的数字n保留小数位 ??????num=String(num.toFixed(n)); ??????varre=/(-?\d+)(\d{3})/; ?...

    301
    热度
  • 相仿usMoney的人民币格式

    类似usMoney的人民币格式 functionRMBMoney(v){ v=(Math.round((v-0)*100))/100; v=(v==Math.floor(v))?v+".00":((v*10==Math.floor(v*10))?v+"0":v); v=String(v); varps=v.split('.'); varwhole=ps[0]; varsub=ps[1]?'.'+p...

    107
    热度
  • java 远路读取流文件

    java远程读取流文件 publicStringgetYCFile(StringurlPath){ StringreadStr=""; try{ try{ StringstrUrl=urlPath.trim(); URLurl=newURL(strUrl); HttpURLConnectionurlCon=(HttpURLConnection)url.openConnection(); urlCo...

    138
    热度
  • 取得Event对象

    获得Event对象 functiongetEvent(){//同时兼容ie和ff的写法 if(document.all)returnwindow.event; func=getEvent.caller; while(func!=null){ vararg0=func.arguments[0]; if(arg0){ if((arg0.constructor==Event||arg0.constru...

    285
    热度
  • jsp图片不在工程内的展示

    jsp图片不在工程内的显示 1.src=‘请求路径’2.后台代码publicvoiddoGetImage(HttpServletRequestrequest,HttpServletResponseresponse) throwsServletException,IOException{ response.setContentType("text/html;charset=GBK"); res...

    313
    热度
  • myql存储过程,如何解决这个有关问题?(查不到记录时,不跳出循环。)

    myql存储过程,怎么解决这个问题?(查不到记录时,不跳出循环。。。)本帖最后由senlinmuvs于2012-04-1209:41:35编辑DELIMITER//DROPPROCEDUREIFEXISTStest//CREATEPROCEDUREtest()BEGINDECLAREresults,id2,cINTDEFAULT0;DECLAREcur_1CURSORFORSELECTidFROM...

    4462
    热度
  • php文件有关问题请问

    php文件问题请教问题背景:我有个php文件叫做test.php还有个文件夹叫做tmp_data这两个文件是在同级目录下。说明tmp_data文件里面有个tmp.txt文件现在上test.php代码:PHPcode <?php $dir="./tmp_data"; //打开目录$dir,并将目录句柄赋给变量$dh if($dh=opendir($dir)) { //通过...

    105
    热度
  • PHP 五 入门 读、写文本文件(二)

    PHP5入门读、写文本文件(二) ?? =============== 写文件 =============== $realFiePath="D:/test.txt"; $fileContent="Test20110312."; ? $file=fopen($realFiePath,'wb'); fwrite($file,$fileContent); fclose($file); ? ? =====...

    605
    热度
  • 研究php中break,continue,exit的应用与区别

    研究php中break,continue,exit的使用与区别 1.break跳出代码片段,结束循环 2.continue结束当前片段,继续下一次循环 3.exit结束整个PHP代码 <?php /*php的break,continue,return的简单区别代码*/ $i=1; while(true){//这里看上去这个循环会一直执行 if($i==2){//2跳过不显示 $i++; c...

    620
    热度
  • php批量批改文件后缀

    php批量修改文件后缀<?php functionforeachDir($path){ $handle=opendir($path); if($handle){ while(false!==($file=readdir($handle))){ if($file!="."&&$file!='..'){ if(is_dir($path.$file)){ ech...

    273
    热度
  • PHP读写资料代码

    PHP读写文件代码 <?php $str1="writesomethingintofile."; $str2="thisisatextfile."; $filename="C:/data/01.txt"; //写文件 $file=fopen($filename,"w"); $w1=fwrite($file,$str1); $w1=fwrite($file,"\r\n"); $w1=fw...

    371
    热度
  • php遍历文件夹(取得文件名)

    php遍历文件夹(获得文件名) http://www.cublog.cn/u1/43167/showart_374765.htmlfunctionlistFile($dir) { $fileArray=array(); $cFileNameArray=array(); if($handle=opendir($dir)) { while(($file=readdir($handle))!==fals...

    127
    热度