---
title: "How to remove comma from array list?"  
description: "How to remove comma from array list?"  
author: "Royce Roy"  
published: 2014-10-17  
updated: 2014-10-17  
canonical: https://www.mindstick.com/forum/2399/how-to-remove-comma-from-array-list  
category: "java"  
tags: ["android", "java"]  
reading_time: 2 minutes  

---

# How to remove comma from array list?

I have an [Arraylist](https://www.mindstick.com/articles/11973/arraylist-class-in-c-sharp) where I place [float](https://www.mindstick.com/interview/1718/describe-float-containment) values.\

```
xEvent.add(fileTimeStamp);            xEvent.add(x);            xEvent.add(zCSV + "\n");    String formatedString = xEvent.toString()                                .replace("[", "") // remove the right bracket                                .replace("]", "") // remove the left bracket
```

The [problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic) is that the Arraylist places a comma to separate values. How can I get rid of this comma without [getting rid](https://answers.mindstick.com/qa/109828/how-to-clean-a-mechanical-keyboard-without-getting-rid-of-keycaps) of the comma that in some locales is used as the [decimal](https://www.mindstick.com/forum/34709/please-write-a-program-for-decimal-to-binary-conversion-in-c-sharp) mark? On the U.S. we use the [period](https://yourviews.mindstick.com/story/2247/some-great-indian-dynasties-before-mughal-period) as the decimal mark, so removing all commas would work, however on countries where they use the comma as the decimal mark I would [end up](https://www.mindstick.com/forum/156243/how-can-i-make-sure-my-emails-don-t-end-up-in-the-spam-folder) ruining the data.

## Replies

### Reply by Samuel Fernandes

I'm not sure you can errase the ',' from the to string without ruining the data, I would recomend using a for() to get the information\

```
String formatedString="";for(String s: xEvent){    formatedString += s;}
```

Like this you will get all the information inside a String without the ']','[' or ','. Hope it helps you.


---

Original Source: https://www.mindstick.com/forum/2399/how-to-remove-comma-from-array-list

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
