to_be

package module
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2026 License: BSD-3-Clause Imports: 3 Imported by: 0

README

to-be.Go

Simple Go library determining the truthyness of strings, that is whether they indicate truey or falsy values.

Language License GitHub release Last Commit Go Go Reference

Table of Contents

Introduction

to-be is a library providing facilities for determine whether the truthyness of strings. It implemented in several languages: to-be.Go is the Go implementation.

Terminology

The term "truthy" is an unhelpfully overloaded term in the programming world, insofar as it is used to refer to the notion of "truthyness" - whether something can be deemed to be interpretable as truth - and also the true side of that interpretation. In this library, the former interpretation is used, leaving us with the following terms:

  • "truthy" - whether something can be can be deemed to be interpretable as having truth;
  • "falsey" - whether an object can be deemed to be interpretable as being false;
  • "truey" - whether an object can be deemed to be interpretable as being true;

For example, consider the following Go program:

package main

import (
	to_be "github.com/synesissoftware/to-be.Go"
)

s1 := "no"
s2 := "True"
s3 := "orange"

// "no" is validly truthy, and is falsey
to_be.StringIsFalsey(s1)  // true
to_be.StringIsTruey(s1)   // false
to_be.StringIsTruthy(s1)  // true

// "True" is validly truthy, and is truey
to_be.StringIsFalsey(s2)  // false
to_be.StringIsTruey(s2)   // true
to_be.StringIsTruthy(s2)  // true

// "orange" is not validly truthy, and is neither falsey nor truey
to_be.StringIsFalsey(s3)  // false
to_be.StringIsTruey(s3)   // false
to_be.StringIsTruthy(s3)  // false

Installation


import to_be "github.com/synesissoftware/to-be.Go"

Components

// Indicates that the given string, when trimmed, is classified as "truthy"
// and is deemed as "falsey".
func StringIsFalsey(s string) bool

// Indicates that the given string, when trimmed, is classified as "truthy"
// and is deemed as "truey".
func StringIsTruey(s string) bool

// Indicates that the given string, when trimmed, is classified as "truthy"
// and is deemed as "truey".
func StringIsTruthy(s string) bool

func Version() uint64
func VersionString() string

Examples

Examples are provided in the examples directory, along with a markdown description for each. A detailed list TOC of them is provided in EXAMPLES.md.

Project Information

Where to get help

GitHub Page

Contribution guidelines

Defect reports, feature requests, and pull requests are welcome on https://github.com/synesissoftware/to-be.Go.

Dependencies
Development/Testing Dependencies
License

to-be.Go is released under the 3-clause BSD license. See LICENSE for details.

Documentation

Index

Constants

View Source
const (
	VersionMajor uint16 = 0
	VersionMinor uint16 = 3
	VersionPatch uint16 = 1
	VersionAB    uint16 = ver2go.Release
)

Variables

This section is empty.

Functions

func StringIsFalsey

func StringIsFalsey(s string) bool

Indicates that the given string, when trimmed, is classified as "truthy" and is deemed as "falsey".

func StringIsTruey

func StringIsTruey(s string) bool

Indicates that the given string, when trimmed, is classified as "truthy" and is deemed as "truey".

func StringIsTruthy

func StringIsTruthy(s string) bool

Indicates that the given string, when trimmed, is classified as "truthy" (and is deemed as either "falsey" or "truey").

func Version

func Version() uint64

Version returns this library's version as a packed 64-bit integer, formed by ver2go.CombineVersion from VersionMajor, VersionMinor, VersionPatch, and VersionAB. The result is suitable for numeric comparison: a later release has a strictly greater value than an earlier one that uses the same packing.

func VersionString

func VersionString() string

VersionString returns this library's version as a human-readable string, formed by ver2go.CalcVersionString from VersionMajor, VersionMinor, VersionPatch, and VersionAB. For a final (non-prerelease) version the result is of the form "MAJOR.MINOR.PATCH", e.g. "0.3.1".

Types

This section is empty.

Directories

Path Synopsis
examples
libver command
to_be command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL