发布新日志

  • JavaScript split() 方法

    2018-02-28 14:27:07

    定义和用法

    split() 方法用于把一个字符串分割成字符串数组。

    提示: 如果把空字符串 ("") 用作 separator,那么 stringObject 中的每个字符之间都会被分割。

    注意: split() 方法不改变原始字符串。

    实例

    把一个字符串分割成字符串数组:

    var str="How are you doing today?";
    var n=str.split(" ");

    n 输出一个数组的值:

    How,are,you,doing,today?
  • JAVA 例子

    2010-12-03 15:22:45

    package junittest;
    import java.util.*;
    import junit.framework.*;

    class test1 {
        public static void main(String args[]) {
            testsimple b = new testsimple();
            double result;
            // call all versions of test()
            ob.test();
            ob.test(10);
            ob.test(10, 20);
            result = ob.test(123.40);
        }
    }
    class testsimple {
        void test() {
            System.out.println("No parameters");
        }

        void test(int a) {
            System.out.println("a:" + a);
        }

        void test(int a, int b) {
            System.out.println("a and b:" + a + " " + b);
        }

        double test(double a) {
            System.out.println("double a: " + a);
            return a;
        }
    }

Open Toolbar