namespace ACE.Common.Extensions
{
///
/// This is a Helper Extension to service common String functions for Names
///
public static class CharacterNameExtensions
{
///
/// This is a Player Name Helper that converts a string array into a string with necessary spaces throughout. This is used by server commands.
///
/// Array of strings, may contain spaces.
/// The starting position of the array where the character name begins. This is usually 1 when working with server commands.
/// string containing a character or account name
public static string StringArrayToCharacterName(string[] nameStrings, int startingElement = 0)
{
// Store the first part of the player name.
string characterName = nameStrings[startingElement];
// Determine if the name has a space
if (nameStrings.Length > 2)
{
// Build the name
// characterName should already contain one element, so we start at the next position:
for (int i = (startingElement + 1); i < nameStrings.Length; i++)
{
characterName = characterName + " " + nameStrings[i];
}
}
return characterName;
}
}
}