ascii

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: May 27, 2021 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 ControlCharToASCII added in v1.1.2

func ControlCharToASCII(data string) string

ControlCharToASCII converts non-printable control char represented in word to ascii non-printable form

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 EscapeNonPrintable added in v1.1.2

func EscapeNonPrintable(data string) string

EscapeNonPrintable converts non printable \x00 - \x1f to pseudo escaped format

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, ignoreValueToLeftOfDelimiterSymbol ...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.

ignoreValueToLeftOfDelimiterSymbol = if set, any value to left side of this delimiter (along with this delimiter) is excluded from the return result

func UnescapeNonPrintable added in v1.1.2

func UnescapeNonPrintable(data string) string

UnescapeNonPrintable converts pseudo escaped back to non printable form

Types

This section is empty.

Jump to

Keyboard shortcuts

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