strongStringGo

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2021 License: MIT Imports: 5 Imported by: 3

Documentation

Index

Constants

View Source
const (
	COMMAND_PREFIX1 = "!"
	COMMAND_PREFIX2 = "/"
	SUDO_PREFIX1    = ">"
	FLAG_PREFIX     = "--"
)

the prefix values for commands.

View Source
const (
	JA_Flag       = "〰\u200d;〰"
	JA_Str        = "❞\u200d;" // start character (") for string in japanese.
	JA_Equality   = "=\u200d;" // equal character (=) in japanese.
	JA_Ddot       = ":\u200d;" // ddot character (:) in japanese.
	JA_Cama       = "、\u200d;" // cama character (,) in japanese.
	JA_RealStr    = "\uff4e"   // the real str
	JA_BrOpen     = "「\u200d;" // the real str
	JA_BrClose    = "」\u200d;" // the real str
	BACK_Str      = `\"`
	BACK_Flag     = `\--`
	BACK_Equality = `\=`
	BACK_Ddot     = `\:`
	BACK_Cama     = `\,`
	BACK_BrOpen   = `\[`
	BACK_BrClose  = `\]`
)
View Source
const (
	BaseIndex      = 0  // number 0
	BaseOneIndex   = 1  // number 1
	BaseTwoIndex   = 2  // number 2
	BaseThreeIndex = 3  // number 2
	Base4Bit       = 4  // number 8
	Base8Bit       = 8  // number 8
	Base16Bit      = 16 // number 16
	Base32Bit      = 32 // number 32
	Base64Bit      = 64 // number 64
	BaseTimeOut    = 40 // 40 seconds
	BaseTen        = 10 // 10 seconds
)

the base constant values.

View Source
const (
	BaseIndexStr    = "0" // number 0
	BaseOneIndexStr = "1" // number 1
	DotStr          = "." // dot : .
	LineStr         = "-" // line : -
	EMPTY           = ""  //an empty string.
	UNDER           = "_" // an underscope : _
	STR_SIGN        = `"` // the string sign : "
	CHAR_STR        = '"' // the string sign : '"'
)

additional constants which are not actually used in this package, but may be useful in another packages.

View Source
const (
	APP_PORT        = "PORT"
	GET_SLASH       = "/"
	HTTP_ADDRESS    = ":"
	FORMAT_VALUE    = "%v"
	SPACE_VALUE     = " "
	LineEscape      = "\n"
	R_ESCAPE        = "\r"
	SEMICOLON       = ";"
	CAMA            = ","
	ParaOpen        = "("
	ParaClose       = ")"
	NullStr         = "null"
	DoubleQ         = "\""
	SingleQ         = "'"
	DoubleQJ        = "”"
	BracketOpen     = "["
	Bracketclose    = "]"
	Star            = "*"
	BackSlash       = "\\"
	DoubleBackSlash = "\\\\"
	Point           = "."
	AutoStr         = "auto"
	AtSign          = "@"
	EqualStr        = "="
	DdotSign        = ":"
	Yes             = "Yes"
	No              = "No"
	TrueStr         = "True"
	FalseStr        = "False"
	OnStr           = "On"
	OffStr          = "Off"
	LowerYes        = "yes"
	LowerNo         = "no"
	LowerTrueStr    = "true"
	LowerFalseStr   = "false"
	LowerOnStr      = "on"
	LowerOffStr     = "off"
	OrRegexp        = "|" // the or string sign: "|"
)

router config values

View Source
const (
	LineChar         = '-' // line : '-'
	EqualChar        = '=' // equal: '='
	SpaceChar        = ' ' // space: ' '
	DPointChar       = ':' // double point: ':'
	BracketOpenChar  = '[' // bracket open: '['
	BracketcloseChar = ']' // bracket close: ']'
	CamaChar         = ',' // cama: ','
)
View Source
const (
	JA_FLAG       = "〰〰"
	JA_STR        = "❞" // start character (") for string in japanese.
	JA_EQUALITY   = "=" // equal character (=) for string in japanese.
	JA_DDOT       = ":" // equal character (=) for string in japanese.
	BACK_STR      = "\\\""
	BACK_FLAG     = "\\--"
	BACK_EQUALITY = "\\="
	BACK_DDOT     = "\\:"
)

Variables

This section is empty.

Functions

func AreEqual added in v1.0.4

func AreEqual(s1, s2 *string) bool

AreEqual will check if two string ptr are equal to each other or not.

func FixSplit

func FixSplit(myStrings []string) []string

FixSplit will fix the bullshit bug in the Split function (which is not ignoring the spaces between strings).

func FixSplitWhite added in v1.0.4

func FixSplitWhite(myStrings []string) []string

FixSplit will fix the bullshit bug in the Split function (which is not ignoring the spaces between strings).

func IsAllNumber added in v1.0.4

func IsAllNumber(str string) bool

func IsAllNumbers added in v1.0.4

func IsAllNumbers(str ...string) bool

func IsEmpty

func IsEmpty(s *string) bool

IsEmpty function will check if the passed-by string value is empty or not.

func IsRuneNumber added in v1.0.4

func IsRuneNumber(r rune) bool

func ParseConfig added in v1.0.7

func ParseConfig(value interface{}, filename string) error

func Split

func Split(s string, separator ...string) []string

func SplitN

func SplitN(s string, n int, separator ...string) []string

func SplitSlice

func SplitSlice(s string, separator []string) []string

func SplitSliceN

func SplitSliceN(s string, separator []string, n int) []string

func SplitSliceNWhite added in v1.0.4

func SplitSliceNWhite(s string, separator []string, n int) []string

func SplitWhite added in v1.0.4

func SplitWhite(s string, separator ...string) []string

SplitWhite splits the string with the given separator and will remove the white spaces slices from the results

func ToArray added in v1.0.4

func ToArray(strs ...string) []string

func ToBool added in v1.0.5

func ToBool(str string) bool

func ToStrSlice

func ToStrSlice(qs []QString) []string

func YesOrNo

func YesOrNo(v bool) string

YesOrNo returns yes if v is true, otherwise no.

Types

type QString added in v1.0.4

type QString interface {
	Length() int
	IsEmpty() bool
	GetValue() string
	GetIndexV(int) rune
	IsEqual(QString) bool
	Split(...QString) []QString
	SplitN(int, ...QString) []QString
	SplitFirst(qs ...QString) []QString
	SplitStr(...string) []QString
	SplitStrN(int, ...string) []QString
	SplitStrFirst(...string) []QString
	Contains(...QString) bool
	ContainsStr(...string) bool
	ContainsAll(...QString) bool
	ContainsStrAll(...string) bool
	TrimPrefix(...QString) QString
	TrimPrefixStr(...string) QString
	TrimSuffix(...QString) QString
	TrimSuffixStr(...string) QString
	Trim(qs ...QString) QString
	TrimStr(...string) QString
	Replace(qs, newS QString) QString
	ReplaceStr(qs, newS string) QString
	LockSpecial()
	UnlockSpecial()
	ToBool() bool
}

func Qsb

func Qsb(b []byte) QString

QSb will generate a new QString with the specified non-encoded bytes value.

func Qss

func Qss(s string) QString

Qss will generate a new QString with the specified non-encoded string value.

func ToQSlice

func ToQSlice(strs []string) []QString

type StrongString

type StrongString struct {
	// contains filtered or unexported fields
}

the StrongString used in the program for additional usage.

func Sb

func Sb(b []byte) StrongString

Sb will generate a new StrongString with the specified non-encoded bytes value.

func Ss

func Ss(s string) StrongString

Ss will generate a new StrongString with the specified non-encoded string value.

func SsPtr

func SsPtr(s string) *StrongString

SS will generate a new StrongString with the specified non-encoded string value.

func (*StrongString) Contains

func (s *StrongString) Contains(qs ...QString) bool

func (*StrongString) ContainsAll

func (s *StrongString) ContainsAll(qs ...QString) bool

func (*StrongString) ContainsStr

func (s *StrongString) ContainsStr(str ...string) bool

func (*StrongString) ContainsStrAll

func (s *StrongString) ContainsStrAll(str ...string) bool

func (*StrongString) GetIndexV

func (s *StrongString) GetIndexV(index int) rune

GetIndexV method will give you the rune in index. if the passed-by `index` is out of range, it will return zero index of the value.

func (*StrongString) GetValue

func (s *StrongString) GetValue() string

GetValue will give you the real value of this StrongString.

func (*StrongString) HasPrefix

func (s *StrongString) HasPrefix(values ...string) bool

HasPrefix will check if at least there is one prefix is presents in this StrongString or not. the StrongString should starts with at least one of these prefixes.

func (*StrongString) HasPrefixes

func (s *StrongString) HasPrefixes(values ...string) bool

HasPrefixes will check if all of the prefixes are present in this StrongString or not. the StrongString should starts with all of these suffixes. usage of this method is not recommended, since you can use HasSuffix method with only one string (the longest string). this way you will just use too much cpu resources.

func (*StrongString) HasRunePrefix added in v1.0.6

func (s *StrongString) HasRunePrefix(values ...rune) bool

HasRunePrefix will check if at least there is one prefix is presents in this StrongString or not. the StrongString should starts with at least one of these prefixes.

func (*StrongString) HasRunePrefixes added in v1.0.6

func (s *StrongString) HasRunePrefixes(values ...rune) bool

HasRunePrefixes will check if all of the prefixes are present in this StrongString or not. the StrongString should starts with all of these suffixes. usage of this method is not recommended, since you can use HasSuffix method with only one string (the longest string). this way you will just use too much cpu resources.

func (*StrongString) HasSuffix

func (s *StrongString) HasSuffix(values ...string) bool

HasSuffix will check if at least there is one suffix is presents in this StrongString not. the StrongString should ends with at least one of these suffixes.

func (*StrongString) HasSuffixes

func (s *StrongString) HasSuffixes(values ...string) bool

HasSuffixes will check if all of the suffixes are present in this StrongString or not. the StrongString should ends with all of these suffixes. usage of this method is not recommended, since you can use HasSuffix method with only one string (the longest string). this way you will just use too much cpu resources.

func (*StrongString) IsEmpty

func (s *StrongString) IsEmpty() bool

isEmpty will check if this StrongString is empty or not.

func (*StrongString) IsEqual

func (s *StrongString) IsEqual(q QString) bool

isEqual will check if the passed-by-value in the arg is equal to this StrongString or not.

func (*StrongString) Length

func (s *StrongString) Length() int

length method, will give you the length-as-int of this StrongString.

func (*StrongString) LockSpecial

func (s *StrongString) LockSpecial()

LockSpecial will lock all the defined special characters. This way, you don't actually have to be worry about some normal mistakes in spliting strings, cut them out, check them. join them, etc... WARNING: this method is so dangerous, it's really dangerous. we can't say that it's unsafe actually, but still it's really dangerous, so if you don't know what the fuck are you doing, then please don't use this method. this method will not return you a new value, it will effect the current value. please consider using it carefully.

func (*StrongString) Replace

func (s *StrongString) Replace(qs, newS QString) QString

func (*StrongString) ReplaceStr

func (s *StrongString) ReplaceStr(qs, newS string) QString

func (*StrongString) Split

func (s *StrongString) Split(qs ...QString) []QString

func (*StrongString) SplitFirst

func (s *StrongString) SplitFirst(qs ...QString) []QString

func (*StrongString) SplitN

func (s *StrongString) SplitN(n int, qs ...QString) []QString

func (*StrongString) SplitStr

func (s *StrongString) SplitStr(qs ...string) []QString

func (*StrongString) SplitStrFirst

func (s *StrongString) SplitStrFirst(qs ...string) []QString

func (*StrongString) SplitStrN

func (s *StrongString) SplitStrN(n int, qs ...string) []QString

func (*StrongString) ToBool added in v1.0.5

func (s *StrongString) ToBool() bool

func (*StrongString) ToQString

func (s *StrongString) ToQString() QString

func (*StrongString) Trim

func (s *StrongString) Trim(qs ...QString) QString

func (*StrongString) TrimPrefix

func (s *StrongString) TrimPrefix(qs ...QString) QString

func (*StrongString) TrimPrefixStr

func (s *StrongString) TrimPrefixStr(qs ...string) QString

func (*StrongString) TrimStr

func (s *StrongString) TrimStr(qs ...string) QString

func (*StrongString) TrimSuffix

func (s *StrongString) TrimSuffix(qs ...QString) QString

func (*StrongString) TrimSuffixStr

func (s *StrongString) TrimSuffixStr(qs ...string) QString

func (*StrongString) UnlockSpecial

func (s *StrongString) UnlockSpecial()

UnlockSpecial will unlock all the defiend special characters. it will return them to their normal form.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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