Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
重複の可能性: C#でIntをフォーマットするときに符号を強制する方法 +および-記号を使用して数値をフォーマットする
正または負(c#)がある場合に数字に署名したい:
text = cname + " " + String.Format("{0:0.#}", move) + "% , \n " + text;
正の数には「+2.5%」のような形式が必要です。何か案は?
MSDNを確認してください:表示するフォーマット番号
string MyString = number.ToString("+#;-#;0");
; - Section separator-正、負、およびゼロの数値に対して個別のフォーマット文字列を使用してセクションを定義します。
; - Section separator