efficiency

package module
v0.0.0-...-518a5e2 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2023 License: Unlicense Imports: 1 Imported by: 1

Documentation

Overview

in this package, we look into an efficient and inefficient way of doing the same function.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func EfficientWay

func EfficientWay(slices []string) string

EfficientWay takes in a slice of strings to be joined and returns the joined string in an Efficient way by utilizing a function in the standard package strings.Join([]string) string

Example
str := "Johnny Johnny Yes Papa"
slices := strings.Split(str, " ")
str = InefficientWay(slices)
fmt.Println(str)
Output:

Johnny Johnny Yes Papa

func InefficientWay

func InefficientWay(slices []string) string

InefficientWay takes in a slice of strings to be joined and returns the joined string in an inefficient way.

Example
str := "Johnny Johnny Yes Papa"
slices := strings.Split(str, " ")
str = EfficientWay(slices)
fmt.Println(str)
Output:

Johnny Johnny Yes Papa

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL