ascii

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NUL   = 0x00 // '\0' Null
	SOH   = 0x01 //      Start of Header
	STX   = 0x02 //      Start of Text
	ETX   = 0x03 //      End of Text
	EOT   = 0x04 //      End of Transmission
	ENQ   = 0x05 //      Enquiry
	ACK   = 0x06 //      Acknowledgement
	BEL   = 0x07 // '\a' Bell
	BS    = 0x08 // '\b' Backspace
	HT    = 0x09 // '\t' Horizontal Tab
	LF    = 0x0A // '\n' Line Feed
	VT    = 0x0B // '\v' Vertical Tab
	FF    = 0x0C // '\f' Form Feed
	CR    = 0x0D // '\r' Carriage Return
	SO    = 0x0E //      Shift Out
	SI    = 0x0F //      Shift In
	DLE   = 0x10 //      Device Idle
	DC1   = 0x11 //      Device Control 1
	DC2   = 0x12 //      Device Control 2
	DC3   = 0x13 //      Device Control 3
	DC4   = 0x14 //      Device Control 4
	NAK   = 0x15 //      Negative Ack
	SYN   = 0x16 //      Synchronize
	ETB   = 0x17 //      End of Transmission Block
	CAN   = 0x18 //      Cancel
	EM    = 0x19 //      End of Medium
	SUB   = 0x1A //      Substitute
	ESC   = 0x1B // '\e' Escape
	FS    = 0x1C //      Field Separator
	GS    = 0x1D //      Group Separator
	RS    = 0x1E //      Record Separator
	US    = 0x1F //      Unit Separator
	SP    = 0x20 //      Space
	DEL   = 0x7F //      Delete
	COMMA = 0x2C // Comma
	COLON = 0x3A // Colon
	PIPE  = 0x7C // Pipe

)

ascii definition use string(...) to convert the const into string value

Variables

This section is empty.

Functions

func AsciiToString added in v1.1.1

func AsciiToString(i int) string

func ControlCharToWord added in v1.1.1

func ControlCharToWord(data string) string

ControlCharToWord converts non-printable control char to word

func EnvelopWithStxEtxLrc added in v1.1.1

func EnvelopWithStxEtxLrc(contentData string) string

EnvelopWithStxEtxLrc will take content data, wrap with STX, ETX, and calculate LRC to append

contentData = do not include STX, ETX, LRC

func GetLRC added in v1.1.1

func GetLRC(data string) (string, error)

calculate the LRC value for input string, returns blank LRC to indicate error condition (see error for reason)

parameters:

data = includes the STX and ETX but not LRC if exists

returns:

string = LRC string value

func IsCreditCardMod10Valid added in v1.1.1

func IsCreditCardMod10Valid(cardNumber string) (bool, error)

IsCreditCardMod10Valid performs modulo 10 credit card number validation

func IsLRCValid added in v1.1.1

func IsLRCValid(data string) bool

IsLRCValid checks if the input data that contains the entire string, including STX ETX and LRC, that its LRC is valid for the content of the data

func StripStxEtxLrcFromEnvelop added in v1.1.1

func StripStxEtxLrcFromEnvelop(envelopData string) string

StripStxEtxLrcFromEnvelop removes STX ETX and LRC from envelopment and returns content data, this method will validate LRC, if LRC fails, blank is returned

Types

This section is empty.

Jump to

Keyboard shortcuts

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