StringTools - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Names and Strings : StringTools Package : Miscellaneous Utilities : StringTools/DifferencePositions

StringTools

  

DifferencePositions

  

compute the character positions at which two strings differ

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

DifferencePositions( s, t )

Parameters

s

-

string

t

-

string

Description

• 

The DifferencePositions( s, t ) function computes the positions at which the strings s and t differ.  It returns the (ordered) expression sequence of these positions.  If s and t are equal, then NULL is returned. If s and t differ in length, then the positions up to the shorter of s and t are computed and returned.

• 

The length of the returned expression sequence is equal to the Hamming distance between s and t, provided that s and t are the same length. (Note that the HammingDistance command computes the generalized Hamming distance for strings of unequal length.)

Examples

withStringTools:

DifferencePositionsabc,abc

DifferencePositionsabcde,axcye

2,4

(1)

HammingDistanceabcde,axcye

2

(2)

DifferencePositionsabcde,axcyefg

2,4

(3)

HammingDistanceabcde,axcyefg

4

(4)

DifferencePositionsedit,tide

1,2,3,4

(5)

IsDerangementedit,tide

true

(6)

Compatibility

• 

The StringTools[DifferencePositions] command was introduced in Maple 18.

• 

For more information on Maple 18 changes, see Updates in Maple 18.

See Also

HammingDistance

IsDerangement