zoukankan      html  css  js  c++  java
  • 软件测试第二次作业(2)

    package cn.lin.demo;

     

    import java.util.Scanner;

     

    public class Test2 {

        /**

         * @param args

         */

        public static void main(String[] args) {

            // TODO Auto-generated method stub

            Scanner input = new Scanner(System.in);

     

            System.out.print("请输入要测试的字符串:");

            String str = input.nextLine();

            Test2.test(str);

            }

            public static void test(String str){

     

            String[] strArr = str.split("\s+|[,]");

     

            StringBuffer result = new StringBuffer();

     

            for(int i = strArr.length -1;i >=0; i--){

     

            result.append(strArr[i] + " ");

     

     

            }

     

            result.setCharAt(str.length()-0, (char) 0);

     

            System.out.println("颠倒顺序后的字符串:: "+result.toString());

     

            }

     

    }

    package cn.lin.demo;

    import static org.junit.Assert.*;

    import org.junit.Before;

    import org.junit.Test;

    public class Test2Test {

        @Before

        public void setUp() throws Exception {

        }

        @Test

        public void test() throws Exception {

            String str="how are you";

            Test2.test(str);

            }

    }

       

  • 相关阅读:
    Codeforces Round #642 (Div. 3)
    [P4980] 【模板】Polya定理
    [SCOI2016] 幸运数字
    [P4389] 付公主的背包
    [CF438E] The Child and Binary Tree
    最长异或路径
    [AHOI2013] 作业
    [P4841] [集训队作业2013] 城市规划
    Python 第三方库国内镜像安装
    [CF1202D] Print a 1337-string...
  • 原文地址:https://www.cnblogs.com/1a-1a/p/5326840.html
Copyright © 2011-2022 走看看