값이 0인경우 Null 출력 하기
String.Format("{0:##,##}" 변수명);
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | int total_cost = 12140104; int total_money_cost = 8278383; int total_card_cost = -7215663; int total_point_cost = 12280; string output = null ; output = "<div class='summary_boxer-row'>" ; output += "<div class='summary_boxer-box'>" + "<span>" + dsResult.Tables[0].Select().Length + "</span>" + "</div>" ; output += "<div class='summary_boxer-box'>" + "<span>" + String.Format( "{0:##,##}" , total_money_cost) + "</span>" + "</div>" ; output += "<div class='summary_boxer-box'>" + "<span>" + String.Format( "{0:##,##}" , total_card_cost) + "</span>" + "</div>" ; output += "<div class='summary_boxer-box'>" + "<span>" + String.Format( "{0:##,##}" , total_cost) + "</span>" + "</div>" ; output += "<div class='summary_boxer-box'>" + "<span>" + String.Format( "{0:##,##}" , total_point_cost) + "</span>" + "</div>" ; output += "</div>" ; ltl_summary.Text = output; |
값이 0인경우 0 출력하기
String.Format("{0:##,##0}" 변수명);
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | int total_cost = 12140104; int total_money_cost = 8278383; int total_card_cost = -7215663; int total_point_cost = 12280; string output = null ; output = "<div class='summary_boxer-row'>" ; output += "<div class='summary_boxer-box'>" + "<span>" + dsResult.Tables[0].Select().Length + "</span>" + "</div>" ; output += "<div class='summary_boxer-box'>" + "<span>" + String.Format( "{0:##,##0}" , total_money_cost) + "</span>" + "</div>" ; output += "<div class='summary_boxer-box'>" + "<span>" + String.Format( "{0:##,##0}" , total_card_cost) + "</span>" + "</div>" ; output += "<div class='summary_boxer-box'>" + "<span>" + String.Format( "{0:##,##0}" , total_cost) + "</span>" + "</div>" ; output += "<div class='summary_boxer-box'>" + "<span>" + String.Format( "{0:##,##0}" , total_point_cost) + "</span>" + "</div>" ; output += "</div>" ; ltl_summary.Text = output; |
댓글