Java °´×Ö½Ú½ØÈ¡´øÓкº×ÖµÄ×Ö·û´®µÄÒ»ÖÖ×ö·¨
Java °´×Ö½Ú½ØÈ¡´øÓкº×ÖµÄ×Ö·û´®µÄ½â·¨£¬ÍøÉÏÓв»ÉÙÌÖÂÛ¡£ÕâÀïÎÒÒ²¸ø³öÒ»ÖÖÎÒ×Ô¼ºµÄ´¦Àí£¬»ù±¾ÔÀí»¹ÊÇͳ¼ÆÒª½ØÈ¡µÄ×Ö½ÚÊýÖÐÊDZíʾºº×ÖµÄ×Ö½ÚÊýÊÇ·ñÊÇżÊý¸ö£¬¼´ÊÇ·ñ¸ÕºÃ°üÀ¨ÁËÍêÕûµÄºº×Ö¡£
/**
* ±à³Ì£º±àдһ¸ö½ØÈ¡×Ö·û´®µÄº¯Êý£¬ÊäÈëΪһ¸ö×Ö·û´®ºÍ×Ö½ÚÊý£¬Êä³öΪ°´×Ö½Ú½ØÈ¡µÄ×Ö·û´®¡£ µ«ÊÇÒª±£Ö¤ºº×Ö²»±»½Ø°ë¸ö£¬Èç“ÎÒABC”4£¬Ó¦¸Ã½ØΪ“ÎÒAB”£¬ÊäÈë“ÎÒABCººDEF”£¬6£¬Ó¦¸ÃÊä³öΪ“ÎÒABC”¶ø²»ÊÇ“ÎÒABC+ººµÄ°ë¸ö”¡£
* °´ÉÏÊö¹æÔò£¬ÊäÈë“ÎÒABCººDEF 1”£¬Ó¦·µ»Ø¿Õ×Ö·û´®£¬¶ø²»ÊÇ“ÎÒ”¡£
*/
public class CutMultibyte {
public static String cutMultibyte(String splitStr, int extract) {
byte[] bytes = splitStr.getBytes();
//½ØÈ¡×Ö½ÚÊý²»Ð¡ÓÚÔʼ×Ö½ÚÊýʱֱ½Ó·µ»ØÔ×Ö·û´®¡£×¢Òâ×Ö½ÚÊýÒ»¶¨ÒªÓà bytes.length£¬ÓÃ×Ö·û´®µÄ length() ·½·¨·µ»ØµÄÊÇ×Ö·ûÊý£¡
if (extract >= bytes.length) {
return splitStr;
}
else {
int result = 0;
int cutLength = 0;
//ͳ¼Æ³öÔÚÒª½ØÈ¡µÄ×Ö½ÚÖÐÓм¸¸ö×Ö½ÚÊǸºÊý
for (int i = 0; i < extract; i++) {
if (bytes[i] < 0) {
cutLength++;
}
}
//Èô¸ºÊý×Ö½ÚÊýÊÇżÊý£¬¼´Òª½ØÈ¡µÄ×Ö½ÚÊýÖÐÓöµ½¸ÕºÃÊÇÈô¸ÉÍêÕûµÄºº×Ö£¬Ôò½ØÈ¡×Ö½ÚÊý²»±ä£»·ñÔò¸ºÊý×Ö½ÚÊýÊÇÆæÊý£¬±íʾÓöµ½µÄ²»ÊÇÍêÕûºº×Ö£¬½ØÈ¡×Ö½ÚÊý¼õ 1¡£
if (cutLength % 2 == 0) {
result = extract;
}
else {
result = extract - 1;
}
String substrx = new String(bytes, 0, result);
return substrx;
}
}
public static void main(String args[]) {
String str = args[0];
int num = Integer.valueOf(ar
Ïà¹ØÎĵµ£º
JEditorPaneÌṩÈýÖÖÀàÐ͵ÄÎı¾ÏÔʾ£¬text/plain,text/html,text/rtf.
JEditorPaneµÄ¼òµ¥Ó÷¨DEMOÈçÏ£º
package ibees.swing;
import java.awt.Toolkit;
import java.io.IOException;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.event.Hype ......
ÏÐÀ´ÎÞʽ«ÔçЩʱºòÒÑʵÏÖµÄQQµÇ¼½çÃæÔÙʵÏÖÁËÒ»±é£¬´¿ÊÖ¹¤´òÔ죨Òâ˼ÊÇûÓÐÓÃNetBeans¡¢MyEclipseµÄÍ϶¯¹¦ÄÜ£©¡£
Ô´´úÂëÈçÏ£º
package ibees.qq;
import java.awt.BorderLayout;
import java.net.URL;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import j ......
package homework03;
import java.util.Scanner;
/*
* ±àдһ¸öÀ࣬¸ÃÀàÓÐÒ»¸ö·½·¨
* public int f£¨int a£¬int b£©{
*
* }
* È»ºó±àдһ¸ö¸ÃÀàµÄ×ÓÀ࣬ҪÇóÖØд·½·¨f()£¬¶øÇÒÖØдµÄ·½·¨½«·µ»ØÁ½¸öÕûÊýµÄ×îС¹«±¶Êý¡£ÒªÇó£º
* ÔÚÖØдµÄ·½·¨µÄ·½·¨ÌåÖÐÊ×Ïȵ÷Óñ»Òþ²ØµÄ·½·¨·µ»ØaºÍbµÄ×î´ó¹«Ô¼Êým,È»ºó½«a*b/m ......
¶à¼Ì³Ð£º
C++ÖеÄÀà¿ÉÒÔÖ±½ÓʵÏÖ¶à¼Ì³Ð È磺class D:public A,public B,public C{……};
JavaÖв»ÄÜÖ±½ÓʵÏÖÕâÑùµÄ¶à¼Ì³Ð£¬µ«ÊÇ¿ÉÒÔÓýӿڣ¨interface£©À´¼ä½ÓʵÏÖ È磺
public class A{ ……}
public interface C{
¡¡¡¡public void c1();
¡¡¡¡public void c2();
}
public class C exten ......
³¢ÊÔÓÃDOM4j½âÎöspringÅäÖÃÎļþʱ,µÚÒ»²½¶ÁÈ¡Îļþʱ£¬»ñȡ·¾¶¾ÍÓöµ½ÁËÎÊÌ⣬¡£¡£¡£¾¹ýgoogleÁËn+log n ´Î¸öÒ³Ã棬²ÅËãÓÐÁ˸ö´ÖdzµÄÈÏʶ£¬ÏÂÃæ¾ÍÈÃÎÒÓüò¶ÌµÄ»°ÓïÀ´×ܽáһϣ¨ºÃÏñÕâ¶Î¾ÍÈ«ÊÇ·Ï»°¡£¡£¡££©¡£¡£¡£
1¡¢springµÄÅäÖÃÎļþ´æ·ÅλÖÃÓÉweb.xmlÀïµÄcontextConfigLocationÀ´È·¶¨£¬Ò»°ãÊÇ·ÅÔÚweb-inf»òÕßÊÇsrc¸ùÄ¿Â¼Ï ......