Documentation ¶
Index ¶
Examples ¶
Constants ¶
const ( // CelerityRe is a regular expression to match Celerity BBS color codes. CelerityRe string = `\|(k|b|g|c|r|m|y|w|d|B|G|C|R|M|Y|W|S)` // PCBoardRe is a case-insensitive, regular expression to match PCBoard BBS color codes. PCBoardRe string = "(?i)@X([0-9A-F][0-9A-F])" // VBarsRe is a regular expression to match Renegade BBS color codes. VBarsRe string = `\|(0[0-9]|1[1-9]|2[0-3])` )
Variables ¶
var ErrBuff = errors.New("bytes buffer cannot be nil")
Functions ¶
func Celerity ¶
Celerity slices a string into substrings separated by "|" vertical bar codes. The first byte of each substring will contain a Celerity colour value, that are comprised of a single, alphabetic character. An empty slice is returned when no valid Celerity code values exists.
Example ¶
package main import ( "fmt" "github.com/bengarrett/bbs/internal/split" ) func main() { b := []byte("|cHello |C|S|wworld") l := len(split.Celerity(b)) fmt.Printf("Color sequences: %d", l) }
Output: Color sequences: 4
func CelerityHTML ¶ added in v1.0.0
CelerityHTML parses the string for the unique Celerity BBS color codes to apply a HTML template.
func PCBoard ¶
PCBoard slices a string into substrings separated by PCBoard @X codes. The first two bytes of each substring will contain background and foreground hex colour values. An empty slice is returned when no valid @X code values exists.
Example ¶
package main import ( "fmt" "github.com/bengarrett/bbs/internal/split" ) func main() { s := []byte("@X03Hello world") l := len(split.PCBoard(s)) fmt.Printf("Color sequences: %d", l) }
Output: Color sequences: 1
func PCBoardHTML ¶ added in v1.0.0
PCBoardHTML parses the string for the common PCBoard BBS color codes to apply a HTML template.
func VBars ¶ added in v1.0.0
VBars slices a string into substrings separated by "|" vertical bar codes. The first two bytes of each substring will contain a colour value. Vertical bar codes are used by Renegade, WWIV hash and WWIV heart formats. An empty slice is returned when no valid bar code values exists.
Example ¶
package main import ( "fmt" "github.com/bengarrett/bbs/internal/split" ) func main() { b := []byte("|03Hello |07|19world") l := len(split.VBars(b)) fmt.Printf("Color sequences: %d", l) }
Output: Color sequences: 3
Types ¶
This section is empty.