Method AddSuffix
AddSuffix(String, String)
If value
does NOT end with suffix
then returns a new string with the suffix appended, otherwise returns value
.
Declaration
public static string AddSuffix(this string value, string suffix)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The value to add the suffix from. |
System.String | suffix | The suffix to be added. |
Returns
Type | Description |
---|---|
System.String | Either a new string with the specified suffix, or else the original string. |
Remarks
This overload is case sensitive. For a case insensitive version use AddSuffix(String, String, Boolean) with ignoreCase set to true.
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Throw if either |
AddSuffix(String, String, Boolean)
If value
does NOT end with suffix
then returns a new string with the suffix appended, otherwise returns value
.
Declaration
public static string AddSuffix(this string value, string suffix, bool ignoreCase)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The value to add the suffix from. |
System.String | suffix | The suffix to be added. |
System.Boolean | ignoreCase | A boolean indicating whether or not to match the suffix in a case sensitive (true) or insensitive (false) manner. |
Returns
Type | Description |
---|---|
System.String | Either a new string with the specified suffix, or else the original string. |
Remarks
This overload is case sensitive. For a case insensitive version use AddSuffix(String, String, Boolean) with ignoreCase set to true.
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Throw if either |