java×Ö·û´®Ìæ»»×Ö·û´®ÊµÀý,¶Ôreplace·½·¨µÄÖØд
package com.citycollege.stw;
public class testreplace {
public static final String replace( String line, String oldString, String newString )
{
if (line == null)
{
return null;
}
int i=0;
if ( ( i=line.indexOf( oldString, i ) ) >= 0 )
{
char [] line2 = line.toCharArray(); //×Ö·û´®·ÅÈëÊý×é
char [] newString2 = newString.toCharArray(); //ÒªÌæ»»µÄ×Ö·û´®
int oLength = oldString.length(); //±»Ìæ»»µÄ×Ö·û´®µÄ³¤¶È
StringBuffer buf = new StringBuffer(line2.length);
buf.append(line2, 0, i).append(newString2);
i += oLength;
int j = i;
while( ( i=line.indexOf( oldString, i ) ) > 0 )
{
buf.append(line2, j, i-j).append(newString2);
i += oLength;
j = i;
}
buf.append(line2, j, line2.length - j);
return buf.toString();
}
return line;
}
public static void main(String args[]){
String s="I OK OK best OK" +
"She OK OK BESTU OK";
String s1=replace(s,"OK","hello");
System.out.println(s1);
Ïà¹ØÎĵµ£º
ÔÚJava5ÖÐÌṩÁ˱䳤²ÎÊý£¬Ò²¾ÍÊÇÔÚ·½·¨¶¨ÒåÖпÉÒÔʹÓøöÊý²»È·¶¨µÄ²ÎÊý£¬¶ÔÓÚͬһ·½·¨¿ÉÒÔʹÓò»Í¬¸öÊýµÄ²ÎÊýµ÷Óã¬ÀýÈ磺print("hello");print("hello","lisi");print("hello","ÕÅÈý");ÏÂÃæ½éÉÜÈçºÎ¶¨Òå¿É±ä³¤²ÎÊýÒÔ¼°ÈçºÎʹÓÿɱ䳤²ÎÊý¡£
1¡¢¿É±ä³¤²ÎÊý·½·¨µÄ¶¨Òå
ʹÓÃ...±íʾ¿É±ä³¤²ÎÊý£¬ÀýÈç
print(String... args ......
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
public class HashSetDemo {
public static void main(String[] args){
List tableList = new ArrayList();
tableList.add("hello");
tableList.add("hell0");
tableList.add("world");
......
http://xxw8393.blog.163.com/blog/static/3725683420091023535411/
Java µÄ³öÏÖ¸ø´ó¼Ò¿ª·¢´øÀ´µÄ¼«´óµÄ·½±ã¡£µ«ÊÇ£¬Èç¹ûÎÒÃÇÓдóÁ¿ÔÓеľ¹ý¹ã·º²âÊԵķÇJava´úÂ룬½«ËüÃÇÈ«²¿ÓÃJavaÀ´ÖØд£¬¿ÖÅ»á´øÀ´¾Þ´óµÄ¹¤×÷Á¿ºÍ³¤ÆڵIJâÊÔ£»Èç¹ûÎÒÃǵÄÓ¦ÓÃÖÐÐèÒª·ÃÎʵ½Ìض¨µÄÉ豸£¬ÉõÖÁÊǽö·ûºÏ¹«Ë¾ÄÚ²¿ÐÅÏ¢½»»¥¹æ·¶µÄÉ豸 ......
http://xxw8393.blog.163.com/blog/static/37256834200993051226320/
java¶Ôì¶ÎÄ×ֵıàÂëÊÇÒÔ unicodeΪ»ù´¡£¬Òò´Ë£¬ÈôÊÇÒÔZipInputStream¼°ZipOutputStreamÀ´´¦ÀíѹËõ¼°½âѹËõµÄ¹¤×÷£¬Åöµ½ÖÐÎĵµÃû»ò·¾¶£¬Äǵ±È»ÊÇÒÔunicodeÀ´´¦ÀíÂÞ£¡µ«ÊÇ£¬ÏÖÔÚÊÐÃæÉϵÄѹËõ¼°½âѹËõÈíÌ壬ÀýÈçwinzip£¬È´ÊDz»Ö§Ô®unicodeµÄ£¬Ò»Åöµ½µµÃûÒ ......
1.½âÊÍ
ÒòΪjspÓõ½ÁËSiteDataÀ࣬¶øSiteData¼Ì³ÐBasePageÀ࣬
ËùÒÔBasePage¹¹Ô캯Êý
BasePage¹¹Ô캯Êý
initializeByCityCodeº¯Êýmain
keyµÄÖµmain.UpImages
vµÄÖµmain.UpImages
2.Ö´ÐÐÍê BasePage.java
ÖеÄinitCommon()ºó£¬
Ìøµ½SiteData.java ÖÐµÄ process();·½·¨£¬
public SiteData(HttpServletR ......