MCPcopy Create free account
hub / github.com/MCUdude/MicroCore / substring

Method substring

avr/cores/microcore/WString.cpp:617–632  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

615}
616
617String String::substring(unsigned int left, unsigned int right) const
618{
619 if (left > right) {
620 unsigned int temp = right;
621 right = left;
622 left = temp;
623 }
624 String out;
625 if (left >= len) return out;
626 if (right > len) right = len;
627 char temp = buffer[right]; // save the replaced character
628 buffer[right] = '\0';
629 out = buffer + left; // pointer arithmetic
630 buffer[right] = temp; //restore character
631 return out;
632}
633
634/*********************************************/
635/* Modification */

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected