In this post, I will create a simple function that will allow you to ask the user a question, receive a valid response, and return it as a Boolean type. And if needed, the user will be able to tap Ctrl+C at any time to exit the program. Also importantly, despite using the operating system… Continue reading Create a Boolean Yes or No prompt in Go
Go byte units and localized formatting
This article will go through creating byte unit methods for both metric and binary prefixes. The two stringers will take a float64 value and round it with a metric unit. Decimal(15000).String() would return 15.0 kBBinary(15000).String() would return 14.6 KiB Unlike many other byte converters, this will also format the number using international digit separators. While… Continue reading Go byte units and localized formatting
Center text in a terminal with Go.
This guide will show how simple it is to center text in a terminal or a text file using the Go standard and external libraries. We will create two functions, NCenter, which provides for a width parameter, and a Center func that will determine the center placement based on the width of the terminal screen.… Continue reading Center text in a terminal with Go.
You must be logged in to post a comment.