Truncate

Updated: 07/06/2021 by Computer Hope
truncate

Sometimes referred to as prune or trim, truncate is shortening information by removing data at the end. Truncation may be deliberate or accidental. For example, data may be deliberately truncated to conserve memory or simplify the representation of a numerical value. Or, data may be accidentally truncated, for example, by a network transmission that's unexpectedly interrupted by a hardware or software failure.

Example of truncating a URL

As an example of truncating, below is an example of how the URL (Uniform Resource Locator) of this web page could be truncated. Truncating a URL helps you get back to a working web page if a URL is broken and helps find other related pages if the page doesn't have helpful links.

https://www.computerhope.com/jargon/t/truncate.htm

The above URL is of the page you're viewing now. To truncate this URL, we'd remove the last forward slash (/) and everything after it, which in this case is the HTML page.

https://www.computerhope.com/jargon/t

In this example, after removing the HTML page, "t" is the directory containing the page. Our site is designed to automatically redirect visitors entering this URL to all computer T terms. However, many pages redirect you to a listing of files in the directory or open the index file in that directory.

https://www.computerhope.com/jargon

Continuing the same truncating steps earlier returns us to the jargon directory. Again, we've designed our site so that if a visitor truncated back the URL, they'd be automatically forwarded to the computer dictionary.

https://www.computerhope.com

Finally, removing the forward slash directly after the domain name (computerhope.com) and everything after it would get you to the home page. Typically, when trying to find a working page, it's best to try the home page first to see if the website still exists.

How can I truncate text?

The steps for truncating text can vary depending on the source of your text and how you want it to be truncated. In many searching and replacing can truncate some text. However, because the text will likely be different for each line, you'll need to use regular expressions or wildcards to help get better matches.

Tip

You can use our free online Text Tool to help truncate more complex text.

Cut, Formula, Software terms