Remove All Whitespace in Go

Published on 08 October 2024 (Updated: 08 October 2024)

Welcome to the Remove All Whitespace in Go page! Here, you'll find the source code for this program as well as a description of how the program works.

Current Solution

package main

import (
	"fmt"
	"os"
	"strings"
)

func main() {
	errorMessage := "Usage: please provide a string"

	if len(os.Args) < 2 || os.Args[1] == "" {
		fmt.Println(errorMessage)
		os.Exit(1)
	}

	inputString := os.Args[1]
	outputString := strings.Join(strings.Fields(inputString), "")
	fmt.Println(outputString)
}

Remove All Whitespace in Go was written by:

If you see anything you'd like to change or update, please consider contributing.

How to Implement the Solution

No 'How to Implement the Solution' section available. Please consider contributing.

How to Run the Solution

No 'How to Run the Solution' section available. Please consider contributing.