Merge two strings letter by letter in Java?

前端 未结 7 1293
梦毁少年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:57

    public String mixString(String a, String b) {
    StringBuilder sb = new StringBuilder("");
    int longer = 0;
    if (a.length()>b.length()) longer = a.length();
    else longer = b.length();
    for (int i = 0; i 

提交回复
热议问题