VC string segmentation

Source: Internet
Author: User
Just give the separator. Later, I used VC for similar string analysis. VC didn't provide such a function and I couldn't find it after I searched the internet. So I wrote a function myself. Although the function is relatively simple, but some friends may need it, which is just convenient!

Ii. FunctionsCode:
// Parameter description:
Source: The Source string to be split;
DeST: stores the target variables of each string variable after segmentation;
Division: delimiter

Void decodecstring (cstring source, cstringarray & DEST, char Division) {DeST. removeall (); For (INT I = 0; I <source. getlength (); I ++) {If (source. getat (I) = Division) {DeST. add (source. left (I); // remove the right for (Int J = 0; j <(DEST. getsize ()-1); j ++) {Dest [DeST. getsize ()-1] = Dest [DeST. getsize ()-1]. right (Dest [DeST. getsize ()-1]. getlength ()-Dest [J]. getlength ()-1); // remove the left }}}}

Hope to help beginners!

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.