cycle_string

package module
v0.0.0-...-1f2aef4 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2023 License: MIT Imports: 3 Imported by: 0

README

周期循环字符串

TODO 写API文档

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CycleString

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

CycleString 循环字符串

func NewCycleString

func NewCycleString(s string) *CycleString

NewCycleString 创建一个循环字符串

func (*CycleString) At

func (x *CycleString) At(index int) byte

At 返回给定位置的字节,同ByteAt

func (*CycleString) ByteAt

func (x *CycleString) ByteAt(index int) byte

ByteAt 获取给定下标的字节,会按照字节长度获取

func (*CycleString) CharAt

func (x *CycleString) CharAt(index int) rune

CharAt 返回给定位置的字符,同RuneAt

func (*CycleString) Iterator

func (x *CycleString) Iterator() iterator.Iterator[rune]

Iterator 返回一个当前对象的迭代器,当然这个迭代器是没有尽头的

func (*CycleString) MarshalJSON

func (x *CycleString) MarshalJSON() ([]byte, error)

MarshalJSON JSON序列化

func (*CycleString) RealByteLength

func (x *CycleString) RealByteLength() int

RealByteLength 返回真实的字节长度

func (*CycleString) RealRuneLength

func (x *CycleString) RealRuneLength() int

RealRuneLength 返回真实的字符长度

func (*CycleString) RuneAt

func (x *CycleString) RuneAt(index int) rune

RuneAt 获取给定下标的字符,会按照字符长度计算下标

func (*CycleString) String

func (x *CycleString) String() string

转为string的时候只返回原始的字符串

func (*CycleString) SubString

func (x *CycleString) SubString(from, to int) string

SubString 获取当前字符串的子字符串

func (*CycleString) SubStringRune

func (x *CycleString) SubStringRune(from, to int) string

SubStringRune 字符形式的子串

func (*CycleString) UnmarshalJSON

func (x *CycleString) UnmarshalJSON(bytes []byte) error

UnmarshalJSON JSON反序列化

type CycleStringIterator

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

CycleStringIterator 用于迭代一个循环字符串

func NewCycleStringIterator

func NewCycleStringIterator(cycleString *CycleString) *CycleStringIterator

NewCycleStringIterator 基于周期字符串创建一个字符串迭代器

func (*CycleStringIterator) Next

func (x *CycleStringIterator) Next() bool

Next 因为是一个无限循环,所以迭代器的方法永远返回true

func (*CycleStringIterator) Value

func (x *CycleStringIterator) Value() rune

Jump to

Keyboard shortcuts

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