Merge two strings letter by letter in Java?

前端 未结 7 1279
梦毁少年i
梦毁少年i 2021-01-21 22:05

Given two strings, A and B, create a bigger string made of the first char of A, the first char of B, the second char of A, the second char of B, and so on. Any le

7条回答
  •  醉梦人生
    2021-01-21 22:44

    public String mixString(String a, String b) {
      String c="";
      String left="";
      int min;
      if(a.length()>b.length()) {
          min=b.length();
         left=a.substring(b.length(),a.length());
      }
      else {
          min=a.length();
          left=b.substring(a.length(),b.length());
      }
    
      for(int i=0;i

提交回复
热议问题