---
title: "COBOL Strings: How to Remove Spaces without Using “Trim” function"
description: "In this post, I have explained How to remove spaces in a String without using Trim function in COBOL"
url: https://srinimf.com/2016/02/25/cobol-strings-how-to-handle-spaces-without-using-trim-function/
date: 2016-02-25
modified: 2026-10-10
author: "Srini"
image: https://i0.wp.com/srinimf.com/wp-content/uploads/2016/02/pexels-photo-5182237.jpeg?fit=1880%2C1253&ssl=1
categories: ["COBOL"]
tags: ["COBOL Strings handling String functions"]
type: post
lang: en
---

# COBOL Strings: How to Remove Spaces without Using “Trim” function

 In COBOL -85 there is no TRIM function. Below are the best methods to track spaces in input strings. Delimiter is one of the best method to remove spaces.

Related[COBOL: All About Null-terminated Strings](https://srinimf.com/2016/01/29/apply-these-technics-to-handle-null-terminated-strings-in-cobol/)

```
String FIRST-STRING DELIMITED BY SPACES
       ' ' DELIMITED BY SIZE
       SECOND-STRING DELIMITED BY SIZE
       INTO OUTPUT-STRING
```

Keep Reading

- [3 Top Ideas to Get String Length in COBOL Unstring](https://srinimf.com/2022/10/01/3-top-ideas-to-get-string-length-in-cobol-unstring/)DateOctober 1, 2022
- [COBOL strings popular ideas to learn now (2 of 2)](https://srinimf.com/2015/07/27/mainframecobol-strings-inspectconcatenation-splitting-2-of-2/)DateJuly 27, 2015
- [COBOL String modification idea using pointer statement](https://srinimf.com/2012/03/28/cobol-string-modification/)DateMarch 28, 2012

### Share this:

-
- [Tweet](https://twitter.com/share)
- [![](https://i0.wp.com/assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_20.png)](https://www.pinterest.com/pin/create/link/?url=https%3A%2F%2Fsrinimf.com%2F2016%2F02%2F25%2Fcobol-strings-how-to-handle-spaces-without-using-trim-function%2F&media=https%3A%2F%2Fi0.wp.com%2Fsrinimf.com%2Fwp-content%2Fuploads%2F2016%2F02%2Fpexels-photo-5182237.jpeg%3Ffit%3D1200%252C800%26ssl%3D1&description=COBOL%20Strings%3A%20How%20to%20Remove%20Spaces%20without%20Using%20%22Trim%22%20function)
-
- [Share on Tumblr](https://www.tumblr.com/share)
- [Share on WhatsApp (Opens in new window) WhatsApp](https://srinimf.com/2016/02/25/cobol-strings-how-to-handle-spaces-without-using-trim-function/?share=jetpack-whatsapp)
- [More](#)
-

- [Print (Opens in new window) Print](https://srinimf.com/2016/02/25/cobol-strings-how-to-handle-spaces-without-using-trim-function/?share=print)
- [Share on Reddit (Opens in new window) Reddit](https://srinimf.com/2016/02/25/cobol-strings-how-to-handle-spaces-without-using-trim-function/?share=reddit)
- [Share on Telegram (Opens in new window) Telegram](https://srinimf.com/2016/02/25/cobol-strings-how-to-handle-spaces-without-using-trim-function/?share=telegram)
- [Email a link to a friend (Opens in new window) Email](mailto:?subject=%5BShared%20Post%5D%20COBOL%20Strings%3A%20How%20to%20Remove%20Spaces%20without%20Using%20%22Trim%22%20function&body=https%3A%2F%2Fsrinimf.com%2F2016%2F02%2F25%2Fcobol-strings-how-to-handle-spaces-without-using-trim-function%2F&share=email)
-

### Like this:

Like Loading…
