Common methods of the CString class----left (), Mid (), right ().

Source: Internet
Author: User

CString Left ( int ncount )                   const; Get the first ncount characters starting from the left 1

CString Mid ( int nfirst )                      const; start with the ncount+1 character on the left, and get all the following characters

CString Mid ( int nfirst, int ncount )    const; start with the nfirst+1 character on the left and get the ncount characters later

CString Right ( int ncount )                  const; Get right-to-left front ncount characters starting from the right 1

Note:

Adding a const to the back of a function means:

If a class declares a constant object, the object can only use the method behind the const.

Cases:

CString A, B;
A = "123456789";


b = A.left (4); Value is: 1234
b = A.mid (3); Value is: 456789
b = A.mid (2, 4); Value is: 3456
b = A.right (4); Value is: 6789

Common methods of the CString class----left (), Mid (), right ().

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.