isSomeString

Determines whether T is a string, i.e. consists of $(D_KEYWORD char), $(D_KEYWORD wchar) or $(D_KEYWORD dchar).

The character type of the string can be qualified with $(D_KEYWORD const), $(D_KEYWORD immutable) or $(D_KEYWORD inout), but an occurrence of $(D_KEYWORD shared) in the character type results in returning $(D_KEYWORD false). The string itself (in contrast to its character type) can have any type qualifiers.

Static character arrays are not considered strings.

enum bool isSomeString(T);

Return Value

$(D_KEYWORD true) if T is a string, $(D_KEYWORD false) otherwise.

Examples

static assert(isSomeString!(dchar[]));
static assert(isSomeString!(char[]));
static assert(isSomeString!(wchar[]));

static assert(isSomeString!dstring);
static assert(isSomeString!string);
static assert(isSomeString!wstring);

static assert(isSomeString!(const dstring));
static assert(isSomeString!(const string));
static assert(isSomeString!(const wstring));

static assert(isSomeString!(shared dstring));
static assert(isSomeString!(shared string));
static assert(isSomeString!(shared wstring));

static assert(isSomeString!(const(char)[]));
static assert(isSomeString!(inout(char)[]));
static assert(!isSomeString!(shared(const(char))[]));
static assert(!isSomeString!(shared(char)[]));
static assert(!isSomeString!(char[10]));

See Also

$(D_PSYMBOL isNarrowString), $(D_PSYMBOL isWideString).

Meta