PrevUpHomeNext

esv::str_size


Conscious control brain.

esv::str_size - Esvcpp

esv::str_size - A function object to get the length of a string: get the character counter.

Don't waste time on superfluous things.

esv::str_size_class

The function object is the object of instantiated template class esv::str_size_class .

Get String Size - How

Get Array String Size

It gets string size by template type traits.

Get const type_xt * or type_xt * String Size

It gets string size by searching until '\0' is found.

It works on both string literal or string made by new.

For esv::str_size, type_xt is char; for esv::wstr_size, type_xt is wchar_t, ..., etc.

c++ example

#include <esvcpp/core.hpp>
#include <esvcpp/numeric.hpp>	// esv::iota

int main()
{
	char s1[] = "Hell c++!";
	constexpr const char * s2 = "Hell c++!!";
	char * s3 = new char[23];
	esv::iota(s3, '0');
	s3[11] = '\0');

	constexpr auto sz1 = esv::str_size(s1);
	constexpr auto sz2 = esv::str_size(s2);
	auto sz3 = esv::str_size(s3);

	esv::print(sz1, sz2, sz3);
}

See Also

esv::wstr_size

esv::u8str_size

esv::u16str_size

esv::u32str_size

esv::print


PrevUpHomeNext

esv::print