Import std.text.humanize
Humanize
class
Public Class Humanize
Humanize's operations.
Examples
Expect(Humanize.Plural(3, "box") == "3 boxes")
Expect(Humanize.Ordinal(22) == "22nd")
Expect(Humanize.Words(42) == "forty-two")
Expect(Humanize.SnakeCase("HttpServerName") == "http_server_name")
Expect(Humanize.Relative(-180) == "3 minutes ago")-
word's plural: "city" is "cities", "box" "boxes", "leaf" "leaves", "person" "people", and "sheep" "sheep". Of several words, the last one's. A word keeps its capitals, as "TreeNode" does in "TreeNodes", and one in capitals has its ending in them too. -
countandword, thewordin its plural unlesscountis 1 or -1: "3 files", "1 file", and "0 files". -
How long ago a time
secondsfrom now was, whensecondsis negative, "3 minutes ago", or how far off it is, "in 3 minutes", rounded to the unit people would say: "just now" under 45 seconds either way, then a minute, minutes, an hour, hours, a day, days, a month, months, a year, and years. -
How long ago a time
dbefore now was, whendis before 0, or how far off one d from now is, as Relative says it ofd's whole seconds: "3 minutes ago" and "in 2 hours". -
nwith its ordinal's ending: "1st", "2nd", "3rd", "4th", "11th", "22nd", and "113th". -
nin words: "zero", "forty-two", "one thousand two hundred thirty-four", and "minus seven". -
text's words in snake_case: "Hello World", "helloWorld", and "HTTPServer2" are "hello_world", "hello_world", and "http_server2". Words are split at spaces, punctuation, and capitals that start one, and a run of capitals is one word. -
text's words in kebab-case: "hello-world". -
text's words in camelCase: "helloWorld", "httpServer2". -
text's words in PascalCase: "HelloWorld", "HttpServer2".
Report an issue with this page or with FutureBlitz on GitHub.