strncat method

String strncat(
  1. String dest,
  2. String src,
  3. int n
)

Appends up to n characters from the string src to the end of the string dest.

Returns the concatenated string.

Implementation

String strncat(String dest, String src, int n) {
  if (src.length >= n) {
    return dest + src.substring(0, n);
  } else {
    return dest + src;
  }
}