1 // tawesoft.co.uk/go/humanizex 2 // 3 // Copyright © 2021 Tawesoft Ltd <open-source@tawesoft.co.uk> 4 // Copyright © 2021 Ben Golightly <ben@tawesoft.co.uk> 5 // 6 // Permission is hereby granted, free of charge, to any person obtaining a copy 7 // of this software and associated documentation files (the "Software"), to deal 8 // in the Software without restriction, including without limitation the rights 9 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 // copies of the Software, and to permit persons to whom the Software is 11 // furnished to do so, subject to the following conditions: 12 // 13 // The above copyright notice and this permission notice shall be included in all 14 // copies or substantial portions of the Software. 15 // 16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 // SOFTWARE. 23 24 // Package humanizex is an elegant, general-purpose, extensible, modular, 25 // locale-aware way to format and parse numbers and quantities - like distances, 26 // bytes, and time - in a human-readable way ideal for config files and as a 27 // building-block for fully translated ergonomic user interfaces. 28 // 29 // If golang.org/x/text is ever promoted to core then there will be a new version 30 // of this package named `humanize` (dropping the 'x'). 31 // 32 // What about dustin's go-humanize? 33 // 34 // dustin's go-humanize (https://github.com/dustin/go-humanize) is 3.9 to 4.5 35 // times faster formatting and 2 times faster parsing, if this is a bottleneck for 36 // you. It's also quite mature, so is probably very well tested by now. If you're 37 // only targeting the English language it also has more handy "out of the box" 38 // features. 39 // 40 // On the other hand, tawesoft's humanizex is more general purpose and has better 41 // localisation support. Even with those extra features, tawesoft's humanizex 42 // codebase is also smaller and simpler. 43 // 44 // Examples 45 // 46 // Example formatting and parsing Byte quantities in various locales 47 // 48 // https://www.tawesoft.co.uk/go/doc/humanizex/examples/simple/ 49 // 50 // Example leveraging the raw parts of FormatParts to handle durations in a 51 // custom even nicer way for the english language. 52 // 53 // https://www.tawesoft.co.uk/go/doc/humanizex/examples/custom-durations/ 54 // 55 // Example using custom time factors from the Battlestar Galactica 1978 TV 56 // series. 57 // 58 // https://www.tawesoft.co.uk/go/doc/humanizex/examples/custom-factors/ 59 // 60 // 61 // FROZEN - PLEASE MIGRATE 62 // 63 // These packages are moving to https://github.com/tawesoft/golib. 64 // 65 // This is to increase security against possible supply chain attacks such as 66 // our domain name expiring in the future and being registered by someone else. 67 // 68 // Please migrate to https://github.com/tawesoft/golib (when available) instead. 69 // 70 // Most programs relying on a package in this monorepo, such as the dialog or 71 // lxstrconv packages, will continue to work for the foreseeable future. 72 // 73 // Rarely used packages have been hidden for now - they are in the git commit 74 // history at https://github.com/tawesoft/go if you need to resurrect one. 75 // 76 // 77 // Package Information 78 // 79 // License: MIT (see LICENSE.txt) 80 // 81 // Stable: yes 82 // 83 // For more information, documentation, source code, examples, support, links, 84 // etc. please see https://www.tawesoft.co.uk/go and 85 // https://www.tawesoft.co.uk/go/humanizex 86 package humanizex // import "tawesoft.co.uk/go/humanizex" 87 88 // Code generated by internal. DO NOT EDIT. 89 // Instead, edit DESC.txt and run mkdocs.sh.