| |

VerySource

 Forgot password?
 Register
Search
View: 771|Reply: 7

String issues ~~

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-26 16:20:01
| Show all posts |Read mode
How to add INT type to CSTRING type string?
such as
int i = 10;
Then add 10 as a string to the end of a CSTRING string, not the ASCII 10 character.
It doesn't work with +
Reply

Use magic Report

0

Threads

55

Posts

32.00

Credits

Newbie

Rank: 1

Credits
32.00

 China

Post time: 2020-2-17 18:15:01
| Show all posts
CString str1, str2;

str1 = "aaaaaaaaaaaaa";
str2.Formata ("% ld", 10);

str1 + = str2;
Reply

Use magic Report

0

Threads

20

Posts

21.00

Credits

Newbie

Rank: 1

Credits
21.00

 China

Post time: 2020-2-18 07:15:01
| Show all posts
CString str1, str2;

str1 = "aaaaaaaaaaaaa";
str2.Format ("% d", 10);

str1 + = str2;
Reply

Use magic Report

0

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-3-6 11:30:01
| Show all posts
String to number with atoi
Number to string can be directly used CString's Format function!
Reply

Use magic Report

3

Threads

13

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

Post time: 2020-3-7 00:30:01
| Show all posts
Do you know how to wrap the string pointer?
Reply

Use magic Report

1

Threads

27

Posts

23.00

Credits

Newbie

Rank: 1

Credits
23.00

 China

Post time: 2020-3-8 09:45:01
| Show all posts
CString str;
CString str;
.......
ID.Format ("d%", 10);
str = str + ID;
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 Netherlands

Post time: 2020-5-3 11:45:01
| Show all posts
Such a problem, my last processing method is to convert int to char, and then save it into a character array, and then directly connect the two character arrays. Note: the difference between int and char is 48
Reply

Use magic Report

0

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-5-13 14:15:01
| Show all posts
There is the correct answer above
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list