INNER CODE UNIT · Go
EscapeString
benbusby/yeetfile · shared/utils.go:90
func EscapeString(s string) string {
s = strings.ReplaceAll(s, "*", "\\*")
s = strings.ReplaceAll(s, "_", "\\_")
return s
}
func UnescapeString(s string) string {
s = strings.ReplaceAll(s, "\\*", "*")
s = strings.ReplaceAll(s, "\\_", "_")
return s
}
func CalculateNumChunks(fileSize int64) int {
return int(math.Ceil(float64(fileSize) / float64(constants.ChunkSize)))
}
func RemoveOverlap[T comparable](source []T, remove []T) []T {
// Create a map to store the elements to be removed for quick lookup