strings

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2021 License: MIT Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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/c-bata/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/c-bata/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/c-bata/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/c-bata/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