strings

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func IndexNotAny

func IndexNotAny(s, chars string) int

IndexNotAny is similar with strings.IndexAny but showing the opposite behavior.

Example
package main

import (
	"fmt"

	"github.com/RainyBow/go-prompt/internal/strings"
)

func main() {
	fmt.Println(strings.IndexNotAny("golang", "glo"))
	fmt.Println(strings.IndexNotAny("golang", "gl"))
	fmt.Println(strings.IndexNotAny("golang", "golang"))
}
Output:

3
1
-1

func IndexNotByte

func IndexNotByte(s string, c byte) int

IndexNotByte is similar with strings.IndexByte but showing the opposite behavior.

Example
package main

import (
	"fmt"

	"github.com/RainyBow/go-prompt/internal/strings"
)

func main() {
	fmt.Println(strings.IndexNotByte("golang", 'g'))
	fmt.Println(strings.IndexNotByte("golang", 'x'))
	fmt.Println(strings.IndexNotByte("gggggg", 'g'))
}
Output:

1
0
-1

func LastIndexNotAny

func LastIndexNotAny(s, chars string) int

LastIndexNotAny is similar with strings.LastIndexAny but showing the opposite behavior.

Example
package main

import (
	"fmt"

	"github.com/RainyBow/go-prompt/internal/strings"
)

func main() {
	fmt.Println(strings.LastIndexNotAny("golang", "agn"))
	fmt.Println(strings.LastIndexNotAny("golang", "an"))
	fmt.Println(strings.LastIndexNotAny("golang", "golang"))
}
Output:

2
5
-1

func LastIndexNotByte

func LastIndexNotByte(s string, c byte) int

LastIndexNotByte is similar with strings.LastIndexByte but showing the opposite behavior.

Example
package main

import (
	"fmt"

	"github.com/RainyBow/go-prompt/internal/strings"
)

func main() {
	fmt.Println(strings.LastIndexNotByte("golang", 'g'))
	fmt.Println(strings.LastIndexNotByte("golang", 'x'))
	fmt.Println(strings.LastIndexNotByte("gggggg", 'g'))
}
Output:

4
5
-1

Types

This section is empty.

Jump to

Keyboard shortcuts

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