Format Extensions
Capitalize First
This line calls the FormatToCapitalizeFirstLetter extension method to capitalize the first letter of originalString. The result is logged for verification.
Format to Kilo
This example demonstrates how to format a float value, score, into a human-readable string with a "K" or "M" suffix, depending on its size. The formatted score is logged for reference. (1,000 to 1K, 1,000,000 to 1M)
Format to Percentage
This line calls the FormatToPercentage method to convert the ratio into a percentage format. The formatted percentage is logged for clarity.
Format with Separator
This example shows how to format a large float value with thousands separators for better readability. The result is logged for inspection.
Format to Minutes and Seconds
This code formats the timeInSeconds into a string representing minutes and seconds. The result is logged for clarity, showing how the time is structured.
Format to Hours, Minutes, and Seconds
This code formats the timeInSeconds into a string representing minutes and seconds. The result is logged for clarity, showing how the time is structured.
Format to Currency
This line formats a float value as currency using the FormatToCurrency method. The resulting string is logged to show how the currency appears.
Format to Bytes
This code demonstrates how to format a byte size value into a string with appropriate units (B, KB, MB, GB). The formatted size is logged for reference.
Last updated