String assignment and manipulation

Source: Internet
Author: User

String Assignment

string s1;                // default constructor, S1 is empty string string s1 (S2);            // Initialize S2 to a copy of S1 string S3 ("value");        // initializes S3 to a copy of a string literal string S4 (n,'C');        // Initialize S4 to n copies of character ' C '

String manipulation

S.empty ()    // if S is an empty string, returns True, otherwise trues.size ()    // Returns the number of characters in S s[n]        // returns the character of position N in S, where the position is counted from 0 s1+s2        // S1 and S2 are concatenated into a new string, returning the newly generated string s1=s2        //  Replace the S1 content with a copy of S2 s1==s2        // compare S1 and S2 content, equal returns True, otherwise false

String assignment and manipulation

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.