# Splitting Values, Char to String

**URL:** <https://forum.arduino.cc/t/splitting-values-char-to-string/522403>\
**Category:** General Guidance\
**Created:** [April 25, 2018, 5:38am UTC](https://forum.arduino.cc/t/splitting-values-char-to-string/522403 "2018-04-25T05:38:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jiaqibitehumans](https://avatars.discourse-cdn.com/v4/letter/j/dc4da7/32.png) [@jiaqibitehumans](https://forum.arduino.cc/u/jiaqibitehumans)\
**Post date:** [April 25, 2018, 5:38am UTC](https://forum.arduino.cc/t/splitting-values-char-to-string/522403/1 "2018-04-25T05:38:57Z")

</div>

I have received data from my bluetooth and i've been trying to split them up by **','**

for example  
**1.3792162;103.848625,1.379228;103.84878,17.012772,85.0**

right now, I have worked out this code and it works nicely helping me split the value

```cpp
String x = "1,2,3,4";
        
l1 = x.indexOf(',');
startLat = x.substring(0,l1);
Serial.println(startLat);

```

and i am trying to implement it into the loop as my data is being sent in

```cpp
void loop(){
  if (Serial1.available())   
    {  
        value = Serial1.read();
        Serial.print(value);
        
        // sending in data and splitting them
    }
}

```

As from what i know, it is sending in Char values, which i cannot use substring to split them,  
Any other way I can do this?

Thank you

I have also tried

```cpp
String readString;
void loop(){
  if (Serial1.available())   
    {  
        c = Serial1.read();
//        String sVal = String(value); // start lat, start long, end lat, end long, distance, angle
//        Serial.print(sVal);

        if (c == '*'){
          Serial.println();
          Serial.print("Capture: ");
          Serial.println(readString);
          
          l1 = readString.indexOf(',');
          startLat = readString.substring(0, l1);
          Serial.print("Start Lat = ");
          Serial.println(startLat);
        }       
      }
}

```

but it doesn't work, there is no value output in my serial monitor ☹

---

<div class="post-metadata">

**Author:** ![ChrisTenone](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/christenone/32/219804_2.png) [@ChrisTenone](https://forum.arduino.cc/u/ChrisTenone)\
**Post date:** [April 25, 2018, 6:32am UTC](https://forum.arduino.cc/t/splitting-values-char-to-string/522403/2 "2018-04-25T06:32:22Z")

</div>

Hi j'b'humans, look up something called "string parsing". There's a lot of good material on the internet, at all the levels - bare noob to cynical expert.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 5, 2021, 6:33pm UTC](https://forum.arduino.cc/t/splitting-values-char-to-string/522403/3 "2021-05-05T18:33:27Z")

</div>


