Invalid character 3 filtering

Source: Internet
Author: User

Implementation file:

# Include "stdafx. H"

# Include <string>
# Include <vector>
# Include <algorithm>
# Include <functional>

# Include "wordlib. H"
# Include "_ string. H"

Namespace wordlib {

Typedef STD: basic_string <char, chattraintsex >__ string;
Typedef STD: vector <__ string> _ wordlist;

Static const char * _ strwordlib [] = {
"***",
"***",
"***",
"****",
"**** You ",
"Script"
};

Static _ wordlist;

Static _ string _ nullstr = "";

Void _ initwordlist ()
{
If (_ wordlist. Size ()! = 0)
Return;

For (size_t I = 0; I <sizeof (_ strwordlib)/sizeof (const char *); ++ I)
_ Wordlist. push_back (_ strwordlib [I]);

STD: Sort (_ wordlist. Begin (), _ wordlist. End ());
}

Bool _ flyingmagic_2_cut_word isvalid (const char * Str)
{
_ Initwordlist ();

If (STR! = NULL)
{
_ String strsrc (STR );

_ Wordlist: iterator itend = _ wordlist. End ();

For (_ wordlist: iterator it = _ wordlist. Begin (); it! = Itend; ++ it)
{
If (strsrc. Find (* It )! =-1)
Return false;
}
}

Return true;
}

Bool _ flyingmagic_2_cut_word filtrate (char * DST, size_t Len, const char * SRC)
{
_ Initwordlist ();

Bool Bret = false;

If (SRC! = NULL & DST! = NULL & strlen (SRC) <= Len)
{
_ String strsrc (SRC );

_ Wordlist: iterator itend = _ wordlist. End ();

For (_ wordlist: iterator it = _ wordlist. Begin (); it! = Itend; ++ it)
{
_ String: size_type begin = strsrc. Find (* it );
If (begin! =-1)
{
For (_ string: size_type T = 0; t <it-> size (); ++ T)
Strsrc [begin + T] = '';
// Strsrc. Assign (_ nullstr, begin, it-> size ());

Bret = true;
}
}

Strcpy (DST, strsrc. c_str ());
}

Return Bret;
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.