(computing) A (possibly zero-length) string of characters that is contained in another string.
substring
Definitions, parts of speech, synonyms, and sentence examples for substring.
Editorial note
If you're doing a substring match, then use a substring function.
Quick take
(computing) A (possibly zero-length) string of characters that is contained in another string.
Meaning at a glance
The clearest senses and uses of substring gathered in one view.
(computing, transitive) To extract a substring from.
(computing, transitive) To take as a substring.
Definitions
Core meanings and parts of speech for substring.
noun
(computing) A (possibly zero-length) string of characters that is contained in another string.
verb
(computing, transitive) To extract a substring from.
verb
(computing, transitive) To take as a substring.
Example sentences
If you're doing a substring match, then use a substring function.
How about substring searching: Boyer- Moore searches backwards, Rabin Karp computes hashes while others simulate automata.
In Bioinformatics, this is known as the Smith-Waterman algorithm [2] and the result would satisfy the requirements of fuzzy substring matching.
Read in mb of data in a String, substring a couple kb out, and tada!
From the start, you're taught that Strings are immutable objects, so you probably understand that `.substring()` produces a new instance object.
This had some harmful effects for those expecting substring() would always share the underlying char[].
Is it really more common that people do substring and expect the rest to be thrown away than the other way around?
Here is an explanation of the change to `substring()`[0] and why it was done.
Without prior knowledge of the implementation, why would you expect a reference to a substring to hold the entire original string in memory?
You can't just deprecate substring() which is a function that is used in what 90% of the millions of Java applications around the world.
I'd hate to be writing a grammar every time I want to do a substring match.
I definitely think it is more common for a programmer to expect that if they make a substring, and never reference the original string again, only the substring would remain in memory after GC.
Quote examples
The description in the Java 7 API for substring is "Returns a new string that is a substring of this string." That does not suggest any sharing with the parent string; it says "new string".
This is why the article's code example yields such a huge difference in memory usage in Java 6 vs Java 7; it is effectively a sort of "anti-pattern" when used against the new `substring()` method.
In this respect, the Java/Oracle folks likely decided that optimizing for the "parsing/tokenization" use case (where you make lots of substrings from a large original string and thus it makes sense to use the same underlying character array) was more novel and less frequent than the use case of "just pulling a small substring from a much larger one and then discarding the large one."
Proper noun examples
Substring optimization for small but not larger strings.
Frequently asked questions
Short answers drawn from the clearest meanings and examples for this word.
How do you use substring in a sentence?
If you're doing a substring match, then use a substring function.
What does substring mean?
(computing) A (possibly zero-length) string of characters that is contained in another string.
What part of speech is substring?
substring is commonly used as noun, verb.