INNER CODE UNIT · Go

UnescapeString

benbusby/yeetfile · shared/utils.go:96

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
	toRemove := make(map[T]struct{}, len(remove))
	for _, item := range remove {
		toRemove[item] = struct{}{}
	}

	// Create a new slice to store the filtered elements

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…