Input string, match string

Thank you. Today I have a string called "abdcsk". What should I do if I want to type another string to see whether the character on the front side only shows the "abdcsk" face (that is, there will be no fwe and so on)? can I actually do it in strstr? thank you!

CPP
Mar.25,2021

if the granularity of your comparison is a single character, not a whole string, then strstr will not work. It's better to use a double loop, a char and a char to judge for yourself.


use the Set bar of es6
to find the union set and judge the size

.
const s1 = 'abcsk'
const s2 = 'abnn'
if (new Set(s1).size === new Set(s1 + s2).size) {
    // s2s1
} else {
    // s2s1
}

can be handled using the following library functions:
size_t strspn (const char str1, const char str2);

-sharpinclude <stdio.h>
-sharpinclude <stdlib.h>
-sharpinclude <string.h>

int main()
{
    const char* str1 = "ab2dcskabdcskabdcskabdcskabdcsk";
    const char* str2 = "abdcsk";

    size_t l = strspn(str1, str2);
    if (l == strlen(str1)) {
        printf("All characters in str1:<%s> are all in str2:<%s>\n", str1, str2);
    } else {
        printf("The first %d characters in str1:<%s> are in str2:<%s>\n", l, str1, str2);
    }
    return 0;
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3749f-2b5cc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3749f-2b5cc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?