convert the comma from the database into a dot

I take the data from the database with the following code and display it to the screen. Incoming data ',' comes with a comma. Sample : Coordinate: 38,5226900 27,0439733

I am this ',' comma '.' I want to turn to the dot. After convert, I will put the translated version below into the script below. and I want it to open in a new page with a separate button.

<script>
                         // [START maps_streetview_controls]
                         function initPano() {
                             // Note: constructed panorama objects have visible: true
                             // set by default.
                             const panorama = new google.maps.StreetViewPanorama(
                                 document.getElementById("map2"),
                                 {
                                     position: { lat: <%#Eval("Latitude") %>, lng: <%#Eval("Longtitude") %> },
                                     addressControlOptions: {
                                         position: google.maps.ControlPosition.BOTTOM_CENTER,
                                     },
                                     linksControl: false,
                                     panControl: true,
                                     enableCloseButton: true,
                                 }
                             );
                         }
// [END maps_streetview_controls]
                     </script>
 <td ><asp:Label ID="Label24" runat="server" Text=":&nbsp;&nbsp;&nbsp;"><%#Eval("Latitude") %>'  <%#Eval("Longtitude") %>' </asp:Label>

2 answers

  • answered 2021-01-17 02:41 Insomnimatic

    You'll need to perform a string replace on all instances of commas and turn them into decimal points.

    This link explains the replaceAll() function and has examples: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll

  • answered 2021-01-17 03:32 Erhan Şimşek

    <script>
                            const longstring = '<%#Eval("Latitude") %>';
                            longString = lng.toString().replaceAll(",", ".");
                        </script>
                        
                        
                        <script>
                             // [START maps_streetview_controls]
                             function initPano() {
                                 // Note: constructed panorama objects have visible: true
                                 // set by default.
                                 const panorama = new google.maps.StreetViewPanorama(
                                     document.getElementById("map2"),
                                     {
                                         position: { lat: 'longstring', lng: 27.1576267 },
                                         addressControlOptions: {
                                             position: google.maps.ControlPosition.BOTTOM_CENTER,
                                         },
                                         linksControl: true,
                                         panControl: true,
                                         enableCloseButton: true,
                                     }
                                 );
                             }