Problem : I’m to get a custom DateTime format including the AM/PM designator, but I want the “AM” or “PM” […]
Tag: string-formatting
Adding an extension method to the string class – C#
Problem : Not sure what I’m doing wrong here. The extension method is not recognized. using System; using System.Collections.Generic; using […]
C# String Format for hours and minutes from decimal
Problem : Is there a simple string format that will take a decimal representing hours and fractions of hours and […]
Format currency without rounding
Problem : I have the need to format a decimal number as currency but I do not wish for any […]
Format a Social Security Number (SSN) as XXX-XX-XXXX from XXXXXXXXX
Problem : I am getting a social security number (SSN) from a data warehouse. While posting it to a CRM […]
Custom numeric format string to always display the sign
Problem : Is there any way I can specify a standard or custom numeric format string to always output the […]
prevent rounding of decimals when using currency string format
Problem : I have some decimal data coming from an external service. I need to format the data to 2 […]
Why does .NET use a rounding algorithm in String.Format that is inconsistent with the default Math.Round() algorithm?
Problem : I’ve noticed the following inconsistency in C#/.NET. Why is it so? Console.WriteLine(“{0,-4:#.0} | {1,-4:#.0}”, 1.04, Math.Round(1.04, 1)); Console.WriteLine(“{0,-4:#.0} […]
What are some good non-English phrases with singular and plural forms that can be used to test an internationalization and localization library?
Problem : I’ve been working on a .NET library to assist with internationalization of an application. It’s written in C#, […]
C# – Insert a variable number of spaces into a string? (Formatting an output file)
Problem : Alrighty, I’m taking data from a list that I populate a DataGridView with and am exporting it to […]
- 1
- 2