Function: string

string is a function defined in character.c.

Signature

(string &rest CHARACTERS)

Documentation

Concatenate all the argument characters and make the result a string.

Other relevant functions are documented in the string group.

View in manual

Probably introduced at or before Emacs version 18.

Shortdoc

;; string
(string ?a ?b ?c)
    => "abc"

Source Code

// Defined in /usr/src/emacs/src/character.c
{
  ptrdiff_t nbytes = 0;
  for (ptrdiff_t i = 0; i < n; i++)
    {
      CHECK_CHARACTER (args[i]);
      nbytes += CHAR_BYTES (XFIXNUM (args[i]));
    }
  if (nbytes == n)
    return Funibyte_string (n, args);
  Lisp_Object str = make_uninit_multibyte_string (n, nbytes);
  unsigned char *p = SDATA (str);
  for (ptrdiff_t i = 0; i < n; i++)
    {
      eassume (CHARACTERP (args[i]));
      int c = XFIXNUM (args[i]);
      p += CHAR_STRING (c, p);
    }
  return str;
}