Maple Professional
Maple Academic
Maple Student Edition
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professional
MapleSim Academic
Maple T.A. - Testing & Assessment
Maple T.A. MAA Placement Test Suite
Möbius - Online Courseware
Machine Design / Industrial Automation
Aerospace
Vehicle Engineering
Robotics
Power Industries
System Simulation and Analysis
Model development for HIL
Plant Modeling for Control Design
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematics Education
Engineering Education
High Schools & Two-Year Colleges
Testing & Assessment
Students
Financial Modeling
Operations Research
High Performance Computing
Physics
Live Webinars
Recorded Webinars
Upcoming Events
MaplePrimes
Maplesoft Blog
Maplesoft Membership
Maple Ambassador Program
MapleCloud
Technical Whitepapers
E-Mail Newsletters
Maple Books
Math Matters
Application Center
MapleSim Model Gallery
User Case Studies
Exploring Engineering Fundamentals
Teaching Concepts with Maple
Maplesoft Welcome Center
Teacher Resource Center
Student Help Center
StringTools[LongestCommonSubString] - return the longest common substring of two strings
StringTools[LongestCommonSubSequence] - return the longest common subsequence of two strings
Calling Sequence
LongestCommonSubString( s1, s2 )
LongestCommonSubSequence( s1, s2 )
Parameters
s1
-
Maple string
s2
Description
A substring of a string is a contiguous sequence of the characters appearing in . The empty string is a substring of every string. A subsequence of a string is a sequence of characters from , which may not be contiguous in . Every substring of is a subsequence of . For example, is a substring of , and is a subsequence of which is not a substring.
The LongestCommonSubString(s1, s2) command returns from its input strings, s1 and s2, a common substring of maximum length.
Many common substrings of maximum length may exist. Which among the candidates is returned depends upon the suffix structure of the pair of strings, but is deterministic.
The LongestCommonSubSequence(s1, s2) command is similar, but searches for subsequences of the pair of input strings rather than substrings.
Examples
See Also
string, StringTools, StringTools[CommonPrefix], StringTools[CommonSuffix], StringTools[Levenshtein]
Download Help Document