// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
// Standard Library
using System;
using System.Collections.Generic;
using System.Linq;
namespace AWS.GameKit.Editor.Utils
{
///
/// Helper methods for working with strings.
///
public static class StringHelper
{
///
/// Remove all whitespace from a string.
///
/// The string to remove whitespace from.
/// A copy of the input string with all the whitespace removed.
public static string RemoveWhitespace(string text)
{
return string.Concat(text.Where(character => !Char.IsWhiteSpace(character)));
}
///
/// Join a collection of strings into a single string, which is a comma separated list of quoted elements. Example: "\"First\", \"Second\", \"Third\""
///
/// The collection of strings to join.
/// The joined string, or if was empty.
public static string MakeCommaSeparatedList(IEnumerable values)
{
return string.Join(", ", values.Select(value => $"\"{value}\""));
}
}
}