Josn: : Value del_subjosn (Josn:; Value josnA, Josn: : Value josnB)
Explanation: josnB is part of the josnA, function return value, the incoming parameters can also be a string, just realized deleted josnB, thanks!!!!!!!!!! Hurry, I just use this BBS,,,,
CodePudding user response:
Delete the substringchar * DelSubStr (szStr, char * const char * szSubStr) {
Char * pchSub=STRSTR (szStr, szSubStr);
If (pchSub!=NULL) {
Int len=strlen (szSubStr);
Char * pchBehindSub=pchSub + len;
Char * pchCat=pchSub;
Do {
* pchCat++=* pchBehindSub;
} while (* pchBehindSub++!='\ 0');
}
Return szStr;
}
CodePudding user response:
Hello! If I will be two directly into a JSON string string (str1 and str2), I want to call this function also need to define two char *,Char * p1=str1;
Char * p2=str2;
Isn't it? JSON into a string can be called directly after this function? Thank you very much! I am a rookie
CodePudding user response:
Sorry, amend the problem, I found that after converting the JSON string (with the writer. The write ()), can't call the above function,,,,,,,CodePudding user response:
Is similar to the algorithm, not directly to paraphrase, you can change to use the String class functions or other you are familiar withCodePudding user response:
String del_substrjson (string & amp; STR, string & amp; Delstr){
Size_t index=0;
While ((index=STR. Find (delstr))!=the string: : npos)
{
STR. Erase (index, delstr. The size () + 1);
}
Return the STR;
}
Upstairs, thanks you reply me a person ha ha, I later I wrote a function, realized the function of the I ha ha