gitlab.com/evatix-go/core@v1.3.55/coreutils/stringutil/IsContainsPtrSimple.go (about)

     1  package stringutil
     2  
     3  import "strings"
     4  
     5  func IsContainsPtrSimple(
     6  	lines *[]string,
     7  	findingString string,
     8  	startsAtIndex int,
     9  	isCaseSensitive bool,
    10  ) bool {
    11  	if lines == nil || *lines == nil {
    12  		return false
    13  	}
    14  
    15  	length := len(*lines)
    16  
    17  	if length == 0 {
    18  		return false
    19  	}
    20  
    21  	if !isCaseSensitive {
    22  		// insensitive
    23  		for i := startsAtIndex; i < length; i++ {
    24  			if strings.EqualFold((*lines)[i], findingString) {
    25  				return true
    26  			}
    27  		}
    28  
    29  		return false
    30  	}
    31  
    32  	for i := startsAtIndex; i < length; i++ {
    33  		if (*lines)[i] == findingString {
    34  			return true
    35  		}
    36  	}
    37  
    38  	return false
    39  }