Table of Contents

Method MakeUnique

Namespace
DocWright.Formats.Xlsx
Assembly
DocWright.Formats.Xlsx.dll

MakeUnique(string, ICollection<string>)

Makes a name unique within a set of names already taken, by appending a number.

public static string MakeUnique(string name, ICollection<string> taken)

Parameters

name string

A name IsValid(string?) accepts.

taken ICollection<string>

The names already used. Compared ordinally, ignoring case, as Excel does.

Returns

string

A legal name not in taken.

Remarks

The suffix eats into the 31-character budget rather than overflowing it, which is why the base name is truncated before the number is appended.