Method IndexOfFirstDifference
IndexOfFirstDifference(String, String)
Returns the original character position of the first difference between two strings. If the strings are identical, returns -1.
Declaration
public static int IndexOfFirstDifference(this string value, string otherValue)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | The first value to compare. |
| System.String | otherValue | The other value to compare. |
Returns
| Type | Description |
|---|---|
| System.Int32 | A System.Int32 containing the index of the first non-matching character, otherwise returns -1 if the strings are identical. |
Remarks
If otherValue is longer than value but matches up to the end of value then the index returned will be outside the length of value.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | Thrown if |