|
A substring of a string is another string that occurs "in" . For example, "the best of" is a substring of "It was the best of times". This is not to be confused with subsequence, which is a generalization of substring. For example, "Itwastimes" is a subsequence of "It was the best of times", but not a substring. Prefix and suffix are refinements of substring. A prefix of a string is a substring of that occurs at the beginning of . A suffix of a string is a substring that occurs at the ''end'' of . == Substring == A substring (or factor) of a string is a string , where and . A substring of a string is a prefix of a suffix of the string, and equivalently a suffix of a prefix. If is a substring of , it is also a subsequence, which is a more general concept. Given a pattern , you can find its occurrences in a string with a string searching algorithm. Finding the longest string which is equal to a substring of two or more strings is known as the longest common substring problem. Example: The string ana is equal to substrings (and subsequences) of banana at two different offsets:banana ||||| ana|| ||| ana In the mathematical literature, substrings are also called subwords (in America) or factors (in Europe). Not including the empty substring, the number of substrings of a string of length where symbols only occur once, is the number of ways to choose two distinct places between symbols to start/end the substring. Including the very beginning and very end of the string, there are such places. So there are non-empty substrings. 抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)』 ■ウィキペディアで「Substring」の詳細全文を読む スポンサード リンク
|