3.5.2 String TypeWe can represent a single character using a variable of type char, so how do we represent a string that has more than one character? We notice that a string is formed by a string that is linked together. Naturally, the simplest and
3.5.2 String TypeWe can represent a single character using a variable of type char, so how do we represent a string that has more than one character? We notice that a string is formed by a string that is linked together. Naturally, the simplest and
3.5.2 String TypeWe can represent a single character using a variable of type char, so how do we represent a string that has more than one character? We notice that a string is formed by a string that is linked together. Naturally, the simplest and
String data type conversion, string Data Type
String is a final class, providing strings that cannot be modified. Forced type conversion. The String type is everywhere. The following describes some common conversions of String data types.
The String
standard library String type learning
initialization of String type
string S1
Default constructor, S1 is an empty string
string s2 (S1)
Initialize S2 to a copy of S1
string S3 ("value")
Initializes S3 to a copy of a string literal
string S4 (n,
Introduction to String class functions in standard C + +Look, it's not CString.The reason to discard char* strings and select the String class in the C + + standard library is because he compares with the former, doesn't have to worry about enough
1 intMain ()2 {3 stringStr"Hello world!\n");4cout "The size of"" is"str.size ()5"characters, including the newline"Endl;6 return 0;7}View CodeLogically speaking,size()The member function should appear to return an integer value or
I thought the collected code would be a good article. It took a day to find an article called "C # And C ++ data type table. it's almost covered by most of the data, which is a blow to me. some data in this article is not tested. there are also some
From:http://citycowboy.blog.sohu.com/50058804.html
The string class in the C + + standard library is used to discard char* strings. Because he compares with the former, does not have to worry about memory enough, string length, and so on, and as a
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.