C Header file Set resultString to a string value that is
C++; Header file
// ------------------------------------------------------------- //
// Set resultString[] to a string value that is a copy of a specified substring of original string s.
// If specified start position is not located within the string s, then set resultString to the empty string (\"\").
// If specified len < 0, or if (start + len) > the length of s, then set resultString to the longest possible substring.
void stringSubstring(
char resultString[ ], // new string buffer
const int resultBuffSize, // result array buffer size
const char s[ ], // the original string
const int start, // starting position of substring within s
const int len) // length of substring within s
Solution
Hopefully this will work.
void stringSubstring(
char resultString[], // new string buffer
const int resultBuffSize, // result array buffer size
const char s[], // the original string
const int start, // starting position of substring within s
const int len) // length of substring within s
// len<0: longest possible substring
{
int slen = stringLength(s[]); // length of String s
int total = start + len;
if(start > slen){
resultString[] = \"\";
}
else{
if((len < 0) || (total > slen)){
resultString[] = substring(s[],start,slen);
}
}
}
![C++; Header file // ------------------------------------------------------------- // // Set resultString[] to a string value that is a copy of a specified subst C++; Header file // ------------------------------------------------------------- // // Set resultString[] to a string value that is a copy of a specified subst](/WebImages/35/c-header-file-set-resultstring-to-a-string-value-that-is-1105747-1761585193-0.webp)