Sage Modeling and Simulation Library

StringOperations..::..UniqueString Method

Returns a unique string in the context of the strings already in the collection. By default, if Dog exists in the list, and you pass in Dog, it will return Dog:1, then Dog:2 on the next call, and so on. Optionally, you can automatically update the list, and use a template for creating the new string.

Namespace:  Highpoint.Sage.Utility
Assembly:  Sage4 (in Sage4.dll)

Syntax


public static string UniqueString(
	string name,
	List<string> existingNames,
	bool addToList,
	string template
)

Parameters

name
Type: String
The name you want to use.
existingNames
Type: List<(Of <(<'String>)>)>
the list of existing names.
addToList
Type: Boolean
if true, automatically updates the list with the new name.
template
Type: String
The string format to use. It takes as {0} the name, and as {1}, the index, if any, to use.

Return Value

the name you can use - that is unique.