diff options
| author | Jeff Carr <[email protected]> | 2024-02-22 15:55:16 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-02-22 15:55:16 -0600 |
| commit | c3c3901e9a713bbc6ab6c82a0f19f1f798461179 (patch) | |
| tree | b48be0a00c542ff0d0b1b1e70e8b46cce15c26db /chomp.go | |
| parent | da5e5f64555dc38a07b4d01665747dee91d1a82a (diff) | |
Diffstat (limited to 'chomp.go')
| -rw-r--r-- | chomp.go | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -88,3 +88,11 @@ func Chomp(a interface{}) string { handleError(fmt.Errorf(tmp), -1) return "" } + +// this is stuff from a long time ago that there must be a replacement for +func RemoveFirstElement(slice []string) (string, []string) { + if len(slice) == 0 { + return "", slice // Return the original slice if it's empty + } + return slice[0], slice[1:] // Return the slice without the first element +} |
