-
Notifications
You must be signed in to change notification settings - Fork 965
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support of metric numeral expression. fixes #456 #459
Conversation
I don't know if I want to switch or to add ByteSize Syntax. I created this extensions with a syntax near the one from If I switch to the OOP, it will allow devs to use operator overloading for example. If It would be nice to have the possibility to use it, I think it is better to use only the basic |
For the choice of precision, I am thinking about two ways:
public static string ToMetric(this double input, string format,
bool isSplitedBySpace = false, bool useSymbol = true)
{
// ...
return number.ToString(format)
+ (isSplitedBySpace ? " " : String.Empty)
+ GetUnit(symbol, useSymbol);
}
public static string ToMetric(this double input, int n,
bool isSplitedBySpace = false, bool useSymbol = true)
{
// ...
return number.ToString("#." + new string('#', n); // n is the count of numbers
+ (isSplitedBySpace ? " " : String.Empty)
+ GetUnit(symbol, useSymbol);
} Also |
One favor -- Would you be able to rebase this onto the dev branch? If at all possible, it'd a big help. How's this looking from a completion perspective otherwise, is it ready for review? Thanks! |
Actually, nm...I'll handle the merge into dev when you're ready. Don't worry about it. Just let me know when you're ready. Thanks! |
Ok thank you for the help. For now, everything works (AFAIk). I think I will let the support of e < 3 open. If someone want it, just create it. For the two others unchecked features, I would love some advices. I think it is a matter of preference. |
I've rebased this PR onto https://github.com/MehdiK/Humanizer/tree/aloisdg-metric for review |
Nice. Thanks. |
I've merged this in to the dev branch. Thanks for your contribution! |
Hello,
I created the PR because this is a full working draft. I would be glad to get any kind of reviews.
This is my first time with xUnit (coming from NUnit and MsTest). Any help is welcome!
Features:
double
only)double
only)int
supportByteSize
's similar syntaxAlso:
cheers,