Function: substring-no-properties
substring-no-properties is a function defined in fns.c.
Signature
(substring-no-properties STRING &optional FROM TO)
Documentation
Return a substring of STRING, without text properties.
It starts at index FROM and ends before TO. TO may be nil or omitted; then the substring runs to the end of STRING. If FROM is nil or omitted, the substring starts at the beginning of STRING. If FROM or TO is negative, it counts from the end.
With one argument, just copy STRING without its properties.
Other relevant functions are documented in the string group.
Probably introduced at or before Emacs version 22.1.
Shortdoc
;; string
(substring-no-properties (propertize "foobar" 'face 'bold) 0 3)
=> "foo"
Aliases
allout-substring-no-properties (obsolete since 28.1)
Source Code
// Defined in /usr/src/emacs/src/fns.c
{
ptrdiff_t from_char, to_char, from_byte, to_byte, size;
CHECK_STRING (string);
size = SCHARS (string);
validate_subarray (string, from, to, size, &from_char, &to_char);
from_byte = !from_char ? 0 : string_char_to_byte (string, from_char);
to_byte =
to_char == size ? SBYTES (string) : string_char_to_byte (string, to_char);
return make_specified_string (SSDATA (string) + from_byte,
to_char - from_char, to_byte - from_byte,
STRING_MULTIBYTE (string));
}