equal
deleted
inserted
replaced
1963 */ |
1963 */ |
1964 public String concat(String str) { |
1964 public String concat(String str) { |
1965 if (str.isEmpty()) { |
1965 if (str.isEmpty()) { |
1966 return this; |
1966 return this; |
1967 } |
1967 } |
1968 if (coder() == str.coder()) { |
1968 return StringConcatHelper.simpleConcat(this, str); |
1969 byte[] val = this.value; |
|
1970 byte[] oval = str.value; |
|
1971 int len = val.length + oval.length; |
|
1972 byte[] buf = Arrays.copyOf(val, len); |
|
1973 System.arraycopy(oval, 0, buf, val.length, oval.length); |
|
1974 return new String(buf, coder); |
|
1975 } |
|
1976 int len = length(); |
|
1977 int olen = str.length(); |
|
1978 byte[] buf = StringUTF16.newBytesFor(len + olen); |
|
1979 getBytes(buf, 0, UTF16); |
|
1980 str.getBytes(buf, len, UTF16); |
|
1981 return new String(buf, UTF16); |
|
1982 } |
1969 } |
1983 |
1970 |
1984 /** |
1971 /** |
1985 * Returns a string resulting from replacing all occurrences of |
1972 * Returns a string resulting from replacing all occurrences of |
1986 * {@code oldChar} in this string with {@code newChar}. |
1973 * {@code oldChar} in this string with {@code newChar}. |