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);
Ïà¹ØÎĵµ£º
Ôڳɹ¦ÊµÏÖJavaµ÷ÓÃC++Ö®ºó£¬½ÓÏÂÀ´Ïëµ½ÄÜ·ñͨ¹ýJNAʵÏÖJavaµ÷ÓÃFortran£¬½ñÌìÊÔÑéÁËһϣ¬»¹ÊDZȽÏÈÝÒ׵ġ£
ÍøÉÏÓÐÒ»¸öJavaµ÷ÓÃF95µÄÀý×Ó£¬µ«ÊÇÎÒ¿¼ÂDz»½öҪʵÏÖF95µÄµ÷Ó㬻¹ÒªÊµÏÖF77µÄµ÷Óã¬ËùÒÔ·ÑÁËһЩÖÜÕÛ¡£
ÎÊÌâµÄ¹Ø¼üÔÚÓÚF77Ϊ¹ý³ÌÃû×Ô¶¯Ìí¼ÓÁËÒ»¸öβ²¿µÄÏ»®Ïߣ¬ËùÒÔsub1Õâ¸ö¹ý³Ì£¬µ½JavaÒ»¶Ë£¬¾Í±ä³ÉÁËsub1_£¬ ......
×î½ü¹«Ë¾Åöµ½ÐèÒªÓÃͼ±íµÄÐÎʽÏÔʾһЩÊý¾Ý£¬ÎҾͿªÊ¼µ½ÍøÉϲéѯ£¬²éµ½ÁËjfreechartºÍamcharts,ÕâÁ½ÕßÎÒ¶¼ÊµÏÖ¹ýÁË£¬jfreechart×îºóÉú³ÉͼƬ£¬µ«ÊÇͼƬЧ¹û²»ÊÇÎÒÏëÒªµÄ£¬È»ºóÓÖÑо¿amcharts ËüµÄЧ¹ûȷʵºÜºÃ£¬¶øÇÒ¹Ù·½ÍøÕ¾ÉÏ»¹ÓкÃЩÀý×ӿɹ©ÏÂÔØ£¬ÍøÖ·ÊÇ:www.amcharts.com
£¨ÏëÒªÍê³ÉÒ»¸öamchartsͼÐÎÐèÒªswfobjects. ......
http://xxw8393.blog.163.com/blog/static/3725683420091023535411/
Java µÄ³öÏÖ¸ø´ó¼Ò¿ª·¢´øÀ´µÄ¼«´óµÄ·½±ã¡£µ«ÊÇ£¬Èç¹ûÎÒÃÇÓдóÁ¿ÔÓеľ¹ý¹ã·º²âÊԵķÇJava´úÂ룬½«ËüÃÇÈ«²¿ÓÃJavaÀ´ÖØÐ´£¬¿ÖÅÂ»á´øÀ´¾Þ´óµÄ¹¤×÷Á¿ºÍ³¤ÆÚµÄ²âÊÔ£»Èç¹ûÎÒÃǵÄÓ¦ÓÃÖÐÐèÒª·ÃÎʵ½Ìض¨µÄÉ豸£¬ÉõÖÁÊǽö·ûºÏ¹«Ë¾ÄÚ²¿ÐÅÏ¢½»»¥¹æ·¶µÄÉ豸 ......
1¡¢Êä³öÖÐÎÄ¡£
JAVAÔÚÍøÂç´«ÊäÖÐʹÓõıàÂëÊÇ"ISO-8859-1"£¬¹ÊÔÚÊä³öʱÐèÒª½øÐÐת»¯£¬È磺
String str="ÖÐÎÄ";
str=new String(str.getBytes("GB2312"),"8859_1");
µ«Èç¹ûÔÚ±àÒë³ÌÐòʱ£¬Ê¹ÓõıàÂëÊÇ“GB2312”,ÇÒÔÚÖÐÎÄÆ½Ì¨ÉÏÔËÐд˳ÌÐò£¬²»»á³öÏÖ´ËÎÊÌ⣬һ¶¨Òª×¢Òâ¡£
2¡¢´Ó²ÎÊýÖжÁÈ¡ÖÐÎÄ
ÕâÕýºÃÓëÊä³öÏ ......
¡¡¡¡¶ÔÏóÐòÁл¯ºÍ·´ÐòÁл¯µÄ×÷ÓÃÊÇʲô£¬Ò»Ö±²»ÖªµÀ£¬¿´¿´ÏÂÃæµÄ½éÉÜÁ˽âÁËһЩ¡£
¡¡¡¡ÎÒÃǶ¼ÖªµÀ£¬µ±ÎÒÃÇnewÒ»¸ö¶ÔÏóµÄʱºò£¬Java¾Í»áÔÚÄÚ´æÖд´½¨Ò»¸öÏàÓ¦µÄ¶ÔÏó¹©ÎÒÃǺóÐøÊ¹Óá£Èç¹ûÎÒÃǰÑÕâ¸öJava³ÌÐò¹ØµôµÄ»°£¬ÄÇôÕâ¸ö¶ÔÏóÒ²¾ÍËæ×ÅÎÒÃdzÌÐòµÄ¹Ø±Õ¶øÏûʧ£¬ÈçºÎ²ÅÄÜÔÚÕâÖÖÇé¿öϼÌÐø±£´æÕâ¸ö¶ÔÏóÄØ£¿Õâ¾ÍÊÇJavaÐòÁл¯Ò ......