format

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package format contains functions that format numeric values.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromGmailFilterNames added in v0.3.2

func FromGmailFilterNames(s string) string

FromGmailFilterNames removes the " OR " separators between elements in the gmail filters sender list

func GetDomainNames added in v0.3.2

func GetDomainNames(s string) (retval string)

func GetTopLevelDomains added in v0.3.2

func GetTopLevelDomains(s string) (retval string)

func MakeSet added in v0.3.2

func MakeSet(list []string) (retval []string)

func NumSpace

func NumSpace(s string) string

NumSpace formats numeric values for readability by adding spaces every three digits.

e.g.

12345678.87654321 e-42

first, split off any exponent from the mantissa

12345678.87654321  and  e-42

next, split off any decimal part from the integer part

12345678   and    .87654321

next, add spaces between digits in the integer part

12 345 678  and    .876 543 21

finally, add any exponent back to the mantissa

func Reverse

func Reverse(s string) string

Reverse is not utf8 compatible ... focus on

utf8.DecodeRuneInString(s string) (r rune, size int)

func Reverse3

func Reverse3(s string) string

Reverse3 reverses Reference: https://stackoverflow.com/a/1754209

func Reverse4

func Reverse4(s string) string

Reverse4 reverses combines the best from SO answers (Reverse2 and Reverse3)

func Reverse5

func Reverse5(s string) string

Reverse5 returns a string with the bytes of s in reverse order.

func ReverseRune

func ReverseRune(s string) string

ReverseRune returns a string with the runes of s in reverse order. Invalid UTF-8 sequences, if any, will be reversed byte by byte.

Example
fmt.Println(input)
fmt.Println(ReverseRune(input))
Output:

The quick brown 狐 jumped over the lazy 犬
犬 yzal eht revo depmuj 狐 nworb kciuq ehT

func ToGmailFilterNames added in v0.3.2

func ToGmailFilterNames(s string) string

ToGmailFilterNames removes the " OR " separators between elements in the gmail filters sender list

Types

This section is empty.

Jump to

Keyboard shortcuts

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