github.com/projectdiscovery/nuclei/v2@v2.9.15/pkg/protocols/common/helpers/deserialization/helpers.go (about)

     1  package deserialization
     2  
     3  import "bytes"
     4  
     5  func InsertInto(s string, interval int, sep rune) string {
     6  	var buffer bytes.Buffer
     7  	before := interval - 1
     8  	last := len(s) - 1
     9  	for i, char := range s {
    10  		buffer.WriteRune(char)
    11  		if i%interval == before && i != last {
    12  			buffer.WriteRune(sep)
    13  		}
    14  	}
    15  	buffer.WriteRune(sep)
    16  	return buffer.String()
    17  }