StringAlgorithmsCharactersInOrder Method

Note: This API is now obsolete.
Checks if the characters of one of the strings occur in order in the other string. Returns the number of characters in the two strings that match in order. The value will be between 0 and the size of the smallest string.

Example

The following strings match, since the one fully contains the other in order CharactersInOrder("BLUB","aBcLeUgBh") = 4 CharactersInOrder("aBcLeUgBh","BLUB") = 4 The following strings differ by one, since the final B is missing in the long string CharactersInOrder("BLUB","aBcLeUg") = 3 CharactersInOrder("aBcLeUg","BLUB") = 3

Definition

Namespace: DHI.Mike1D.Generic
Assembly: DHI.Mike1D.Generic (in DHI.Mike1D.Generic.dll) Version: 24.0.0.0 (11.1.1.1111)
C#
[ObsoleteAttribute("Use LongestCommonSubsequence")]
public static int CharactersInOrder(
	string s1,
	string s2
)

Parameters

s1  String
String to search for
s2  String
String to search in

Return Value

Int32
0 if full match, > 0 for partial match

See Also