user58373: I want to take the GPS coordinates like 42.1234 per 22.1234 and merge them as a string, with a separator character:
42.1234 x 22.1234
But using this code:
gps_string = (String)gps.location.lat()+' x '+(String)gps.location.lng();
I lose the last decimals and I get:
42.12 x 22.12
The only way I could see full coordinates is by specifying an extra parameter to println, like this:
Serial.println(gps.location.lat(), 6);
How can I create a string containing both two coordinates without losing decimals ? e.g 42.1234 x 22.1234

user7508: If you want 4 decimal places, you may try something like this:
gps_string = String(gps.location.lat(), 4)
           + " x "
           + String(gps.location.lng(), 4);


58373: <p>I want to take the GPS coordinates like <strong>42.1234</strong> per <strong>22.1234</strong> and merge them as a string, with a separator character:</p>

<p><code>42.1234 x 22.1234</code></p>

<p>But using this code:</p>

<p><code>gps_string = (String)gps.location.lat()+' x '+(String)gps.location.lng();</code></p>

<p>I lose the last decimals and I get:</p>

<p><code>42.12 x 22.12</code></p>

<p>The only way I could see full coordinates is by specifying an extra parameter to println, like this:</p>

<p><code>Serial.println(gps.location.lat(), 6);</code></p>

<p>How can I create a string containing both two coordinates without losing decimals ? e.g <code>42.1234 x 22.1234</code></p>
 7508: <p>If you want 4 decimal places, you may try something like this:</p>

<pre class="lang-cpp prettyprint-override"><code>gps_string = String(gps.location.lat(), 4)
           + " x "
           + String(gps.location.lng(), 4);
</code></pre>
