MCPcopy Create free account
hub / github.com/SmingHub/Sming / startsWith

Method startsWith

Sming/Wiring/WString.cpp:609–618  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

607}
608
609bool String::startsWith(const String& prefix, size_t offset) const
610{
611 auto prefix_len = prefix.length();
612 auto len = length();
613 if(prefix_len == 0 || prefix_len > len || offset > len - prefix_len) {
614 return false;
615 }
616 auto prefix_buffer = prefix.cbuffer();
617 return memcmp(&cbuffer()[offset], prefix_buffer, prefix_len) == 0;
618}
619
620bool String::endsWith(char suffix) const
621{

Callers 4

executeMethod · 0.45
executeMethod · 0.45
setFileMapMethod · 0.45

Calls 2

cbufferMethod · 0.80
lengthMethod · 0.45

Tested by

no test coverage detected