| |

VerySource

 Forgot password?
 Register
Search
View: 678|Reply: 4

Asp.net output formatting characters?

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-5 17:40:01
| Show all posts |Read mode
I can use under the console program
console.write ("{0: D5}", 1)
Output 00001

Why under asp.net
response.write (String.Format ("{0: D5}", 1));

Just output 1?
Reply

Use magic Report

0

Threads

15

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-1-6 16:36:01
| Show all posts
// Change to this. . .
string value = 1.ToString (). PadLeft (5, '0');
response.write (value);
Reply

Use magic Report

0

Threads

322

Posts

115.00

Credits

Newbie

Rank: 1

Credits
115.00

 China

Post time: 2020-1-6 17:21:01
| Show all posts
Response.Write (String.Format ("{0: D5}", 1));

Also outputs 00001
Reply

Use magic Report

0

Threads

23

Posts

20.00

Credits

Newbie

Rank: 1

Credits
20.00

 China

Post time: 2020-1-7 08:42:01
| Show all posts
Response.Write (String.Format ("00000", 1));
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-1-10 16:18:02
| Show all posts
Ha ha I wrote the wrong code myself
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