Chinese character problem [comparison]

xiaoxiao2021-03-06  71

I don't know if the chart of the hero, yes ~~

Public class letter {private static string _fromencode_ = "gbk"; private static string _toencode_ = "gbk"; public letter () {}

public static int compare (String str1, String str2) {int result = 0; String m_s1 = null, m_s2 = null; try {m_s1 = new String (str1.getBytes (_FromEncode _), _ ToEncode_); m_s2 = new String (str2. getBytes (_FROMENCODE_), _ toEncode_);} catCH (Exception E) {Return str1.compareto (STR2);} result = ChineseCompareto (m_s1, m_s2); returnrate;}

Public static int getcharcode (string s) {if (s == null && s.equals (")) Return -1; Byte [] b = s.getbytes (); int value = 0; for (int i = 0 i

Public Static Int ChineseCompareto (String S1, String S2) {INT LEN1 = S1.LENGTH (); int LEN2 = S2.LENGTH (); int N = math.min (len1, len2); for (int i = 0; i

PUBLIC STATIC STRING GETBEGINCHARACTER (STRING RES) {String A = Res; String Result = ""; String Current;

For (int i = 0; i = 0) && (Current, "Block")) <= 0) {ix (Letter.comPare Current, "")> = 0) Result = "z"; Else IF (Current, "Press")> = 0) Result = "Y"; Else IF (Current, "")> = 0) Result = "x"; Else IF (CURRENT, "Dig")> = 0) Result = "W"; Else IF (Current, "collapse ")> = 0) Result =" t "; else if (Letter.comPare (Current," Saver ")> = 0) Result =" S "; Else IF (Current," "" > = 0) Result = "r"; Else IF (Current, "period")> = 0) Result = "q"; else if (Letter.comPare (Current, "")> = 0) Result = "p"; Else IF (Current, "Oh")> = 0) Result = "O"; Else IF (Letter.comPare (Current, " ")> = 0) Result =" n "; else if (letter.compare (current," mom ")> = 0) Result =" m "; Else IF (Letter.comPare (Current," Fabric ") > = 0) Result = "L"; Else IF (Letter.comPare (Current, "")> =

0) Result = "k"; Else IF (Current, "Hit")> 0) Result = "J"; Else IF (Letter.comPare (Current, "Ha")> = 0) Result = "h"; Else IF (Current, "")> = 0) Result = "g"; Else IF (Current, "Send")> = 0) Result = "f"; Else IF (CURRENT, "Moth")> = 0) Result = "E"; Else IF (Current, "Take")> = 0) Result = "D "; Else IF (Current," Rub ")> = 0) Result =" C "; Else IF (Letter.comPare (Current," Bar ")> = 0) Result =" B "; Else IF (Current, "ah")> = 0) Result = "a";}} returnrate.touppercase ();} public static void main (String [] args) {letter lt = new Letter (); If (Lt.getBeginCharacter ("Test"). Equals ("CS"))) System.out.Println ("Successed!");}}

转载请注明原文地址:https://www.9cbs.com/read-120513.html

New Post(0)