using System;

namespace QC.QSPR;

public static class StringUtils
{
	public static string ConvertTostring(string[] command)
	{
		try
		{
			string text = "";
			for (int i = 0; i < command.Length; i++)
			{
				text = text + command[i] + " ";
			}
			return text;
		}
		catch (Exception ex)
		{
			Console.WriteLine("Parser.Parser.ConvertTostring(string []) causing exception");
			throw ex;
		}
	}

	public static string AppendUniqueString(this string existing, string textToAppend)
	{
		if (!string.IsNullOrWhiteSpace(textToAppend))
		{
			if (existing == null)
			{
				existing = string.Empty;
			}
			if (existing.Contains(textToAppend))
			{
				return existing;
			}
			existing = existing + ((!string.IsNullOrWhiteSpace(existing)) ? "\r\n" : "") + textToAppend;
		}
		return existing;
	}
}
