asserts.startsWith
Check that text starts with a prefix.
📝Syntax
asserts.startsWith(text, prefix)
[res, msg] = asserts.startsWith(text, prefix)
📥Input Arguments
Parameter Description
text Character vector or string scalar to test.
prefix Expected prefix.
📤Output Arguments
Parameter Description
res true if the assertion passes, false otherwise.
msg assertion failure message, empty on success.
📄Description

The assertion passes when text begins with prefix.

With outputs, a missing prefix is returned as an assertion failure.

💡Examples
Expected prefix
asserts.startsWith('Nelson language', 'Nelson');
Capture a prefix failure
[res, msg] = asserts.startsWith('Nelson language', 'language');
🔗See Also
asserts.endsWithasserts.contains
🕔Version History
Version Description
2.0.0 initial version
Edit this page on GitHub