v1.16.9
ADDED: * netx.IsPub * encodingx/hexx Rest are mostly small corrections and docs
This commit is contained in:
@@ -2,4 +2,14 @@
|
||||
-- draw border around multiline s
|
||||
-- i have a version in python somewhere that does this, should dig that up
|
||||
|
||||
- Tokenize() (new function)
|
||||
-- PosixFilename() (new function) -- https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_282
|
||||
-- strings.ToLower()
|
||||
-- compact consecutive:
|
||||
--- whitespace
|
||||
--- .
|
||||
--- ,
|
||||
-- set custom replacement string (defaults to "_")
|
||||
-- replace whitespace (after/during compact) with _ (customizable?)
|
||||
|
||||
- create bytesx package that duplicates the functions here?
|
||||
|
||||
@@ -10,6 +10,53 @@ import (
|
||||
`unicode`
|
||||
)
|
||||
|
||||
/*
|
||||
HasBookend returns true if string s both begins AND ends with sym.
|
||||
|
||||
It is more strict than [HasBoundary] (which only requires
|
||||
that s has sym at the beginning OR the end.)
|
||||
|
||||
Examples:
|
||||
HasBookend("|foo|", "|") → true
|
||||
HasBookend("|foo", "|") → false
|
||||
HasBookend("foo|", "|") → false
|
||||
HasBookend("fo|o", "|") → false
|
||||
HasBookend("|foo| ", "|") → false // Whitespace prevents match
|
||||
HasBookend(" |foo| ", "|") → false
|
||||
|
||||
sym may be a multi-rune string.
|
||||
If sym is empty, HasBookend will *always* return true.
|
||||
*/
|
||||
func HasBookend(s, sym string) (bounded bool) {
|
||||
|
||||
bounded = strings.HasPrefix(s, sym) && strings.HasSuffix(s, sym)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
/*
|
||||
HasBoundary returns true if string s starts OR ends with symbol sym.
|
||||
|
||||
Examples:
|
||||
HasBoundary("|foo|", "|") → true
|
||||
HasBoundary("|foo", "|") → true
|
||||
HasBoundary("foo|", "|") → true
|
||||
HasBoundary("fo|o", "|") → false
|
||||
HasBoundary("|foo| ", "|") → true
|
||||
HasBoundary(" |foo| ", "|") → false // Whitespace prevents match
|
||||
|
||||
sym may be a multi-rune string.
|
||||
If sym is empty, HasBoundary will *always* return true.
|
||||
|
||||
If you instead require string s to be *enclosed* by sym, see [HasBookend].
|
||||
*/
|
||||
func HasBoundary(s, sym string) (bounded bool) {
|
||||
|
||||
bounded = strings.HasPrefix(s, sym) || strings.HasSuffix(s, sym)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
/*
|
||||
IsAscii returns true if all characters in string s are ASCII.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user