Strings in the Cocos2d-x:: Using const char* and std::stringConst char* is a C-style string, std::string is a C + + style string that encapsulates the const char *Initialize the Std::string object:std::string name = "Tony";std:: string name =
When doing data conversion, it is best to include the head file
#include
#include
#include
#include
USING_NS_CC;
using namespace Std;
In Cocos2d-x, there is also a format brush: ccstring (data conversion often
const char *, stringThe C_str () method of Str or the data () method can be used, the two method returns a value of Cong char * string " Hello " ; Const char *a = str.c_str (); Const char *b = Str.c_str ();const char *-stringThe const
CString string char * character conversion between char (multiple methods), cstringchar
When writing a program, we often encounter various types of conversions, such as conversion between char * CString strings. First, explain the meaning of the
(1) Overview
String and cstring are both string template classes. string is a string class defined by the standard template class (STL) and has been incorporated into the C ++ standard;
Cstring (typedef cstringt> cstring) is the most common string
Next article... (8)MFCString Structure Diagram (this is not a comparison, but it is included here for convenience) (9)Summary To sum up, I personally think that inMFC,ATLUse strings whenever possibleCstringAfter all, they are all children of
String to cstring
Cstring. Format ("% s", String. c_str ());
Convert Char to cstringCstring. Format ("% s", char *);
Char to stringString S (char *);
String to char *Char * P = string. c_str ();
Cstring to stringString S (cstring.
(i) First of all, string and char*: 1, overview 2, the reciprocal transformation of the two: (ii) CString 1, overview 2, CString and the other two transformations
(a) First, string and char*:
1. Overview
In the C language:
1
String
In the program, we often use the transformation of the time format, such as speaking time_t into a string, or turn around, the following is the implementation of the Code. It is divided into two kinds of time formats: 2009-3-24 and 2009-3-24 0:00:08.
Tags:Formatcvcto digital conversion it
Category: VC/C ++
String to cstring
Cstring. Format ("% s", String. c_str ());
Convert Char to cstringCstring. Format ("% s", char *);
Char to stringString S (char *);
String to char *Char * P = string.
(1) Overview
String and CString are both string template classes. string is a string class defined by the standard template class (STL) and has been incorporated into the C ++ standard;
CString (typedef CStringT> CString) is the most common string
(1) Overview
String and cstring are both string template classes. string is a string class defined by the standard template class (STL) and has been incorporated into the C ++ standard;
Cstring (typedef cstringt cstring) is the most common
The following are commonly used conversions between several types to convert string to int .............................. char * to int # include int atoi (const char * nptr); long atol (const char * nptr); long Atoll (const char * nptr); long atoq
Next article...
(8) structure charts of commonly used strings in MFC (this is not a comparison, but it is included here for convenience)
(9) Summary
To sum up, I
Several header files that are easy to confuse
Certificate ----------------------------------------------------------------------------------------------------------------------------------------------------
it is a C ++ special character container
[C/C ++ school] 0730-website and backdoor/structure alignment, structure interview analysis/deep copy and light copy/queue/string Encapsulation?? Websites and webshells
Install the Apache server software on Windwos for testing. Localhost
Change
PostgreSQL Type
the default. NET type
specific types of offers
other. NET Types
bool
bool
Int2
Short
BYTE, sbyte, int, long, float, double, decimal, string
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.