熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> Java開源技術 >> 正文

String 方法 替換 隨機數

2022-06-13   來源: Java開源技術 

  import javautilArrayList;
import javautilRandom;

public class Tes {

    /**
     * @param args
     *
     *
     */
    public void Test() {
        String delims = X;
        String ss = XXX;
        String x = ;
        String dd[] = sssplit(delims);
        for (String me : dd) {
            delims = x;
            Systemoutprintln(me);
        }
    }

    public void test() {
        String testStr = XXX;
        // Systemoutprintln(testStrsubstring( ));


        // 第幾位字符替換

        int position = ;

        if (testStrlength() > ) {
            testStr = testStrsubstring( position ) + A
                    + testStrsubstring(position);
            //     Systemoutprintln(testStrsubstring( position));

            //     Systemoutprintln( testStrsubstring(position));

            Systemoutprintln(testStr);
        }

    }

    public void Test() {
        String delims = X;
        String ss = XXX;
        int count = sslength() ssreplace(delims )length(); //判斷出現變量數

        Systemoutprintln(count);
        Systemoutprintln(sslength());
        Systemoutprintln(ssreplace(delims )length());
        for (int i = ; i < ; i++) {

            Random rdm = new Random(); //創建隨機對象


            String x = null;
            int c = (rdmnextInt() >>> ) % ;//

            x = StringvalueOf(c);
            String dd = ssreplace(delims x);//替換

            Systemoutprintln(dd);
            for (int j = ; j < count; j++) {

            }

        }
        //字符竄復制

        //     String tt;

        // tt= ssstrRep(aaa);


    }

    public void test() {
        String delims = X;
        String ss = XXX;
        int count = sslength() ssreplace(delims )length(); //判斷出現變量數

        Systemoutprintln(count);
        Systemoutprintln(sslength());
        Systemoutprintln(ssreplace(delims )length());
        for (int i = ; i < ; i++) {

            Random rdm = new Random(); //創建隨機對象


            String x = null;
            int c = (rdmnextInt() >>> ) % ;//

            x = StringvalueOf(c);
            String dd = ssreplace(delims x);//替換

            Systemoutprintln(dd);
            for (int j = ; j < count; j++) {

            }

        }

    }

    public void test() {
        String testStr = XXX;
        String delims = X;

        for (int s = ; s < ; s++) {
           for(int i = ;i<;i++)
           {
             if (testStrlength() > ) {
                   int count = testStrreplace(delims )length();
                   int position = count;
                   if(position !=)
                   {
                       Random rdm = new Random(); //創建隨機對象

                       String x = null;
                       int c = (rdmnextInt() >>> ) % ;//

                       x = StringvalueOf(c);
                       testStr = testStrsubstring( position ) + x
                               + testStrsubstring(position);
                       
                    }
                   
                }
                Systemoutprintln(testStr);
           }
            
        
            //     if(position !=)

            //     {

            //         for(int i=;i<;i++)

            //            {


            // }

            // }


        }
    }
public void test()
{
    for(int i=;i<;i++)
    {
         Random rd = new Random(); //創建隨機對象

         String n=;
         //String num=;

         int rdGet; //取得隨機數

         do{
         rdGet=Mathabs(rdnextInt())%+; //產生的隨機數(的鍵位值)

         //rdGet=Mathabs(rdnextInt())%+; //產生的隨機數(az的鍵位值)

         char num=(char)rdGet;
         String dd=CharactertoString(num);
         n+=dd;
        
         }while(nlength()<);//假如長度小於

        
    
        // Systemoutprintln(請輸入位隨機數+n);

         String testStr = XXX;
            String delims = X;
         int count = testStrreplace(delims )length();//判斷第幾個是X

         int count = testStrlength() testStrreplace(delims )length(); //判斷出現變量數

         int position = count;
            
                testStr = testStrsubstring( position ) + n
                        + testStrsubstring();
                Systemoutprintln(testStr);
        
    }
    
            
        

            

    
}

    public static void main(String[] args) {

        Tes t = new Tes();
        //    tTest();

        //        ttest();

        //        tTest();

    //    ttest();

    //    ttest();

        ttest();

    }

}


From:http://tw.wingwit.com/Article/program/Java/ky/201311/27901.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.