Vue js Remove Last Comma from String

Today, We want to share with you Vue js Remove Last Comma from String.
In this post we will show you Remove Last Comma, hear for vuejs remove last comma from Array we will give you demo and example for implement.
In this post, we will learn about vuejs remove last comma from String Example with an example.

Vue js Remove Last Comma from String

There are the Following The simple About Vue js Remove Last Comma from String Full Information With Example and source code.

As I will cover this Post with live Working example to develop VueJS Remove Item From Comma Separated string, so the some major files and Directory structures for this example is following below.

  • index.html
Read Also:  jQuery AJAX Inline CRUD using Laravel MySQL

Deleting Array index in Vue.js

index.html

This is where I will make a simple HTML form and PHP server side source code for our web application. To make the forms simply all souce code copy and write it into your any text editor Like Notepad++, then save file it as index.html.

Example

var vue_str = $.trim($('.txtValue').val());
var lastChar = vue_str.slice(-1);
if (lastChar == ',') {
    vue_str = vue_str.slice(0, -1);
}

<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Vue.delete">
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>Vue.js Remove Last Comma from String</title>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.2.1/vue.min.js"></script>
  <script>
    new Vue({
    el: '#app',
    data: {
      devlopers: ['Jaydeep', 'Krunal', 'Ankit', 'Dhaval']
    },
    methods: {
      remove_array_index (index) {
        // this.devlopers.splice(index, 1)
        this.$delete(this.devlopers, index)
      }
    }
  })

  </script>
</head>
<body>
  <div id="app">
    <ol>
      <li v-for="dev, index in devlopers">
        {{dev}}
        <button @click="remove_array_index(index)">×</button>
      </li>
    </ol>
  </div>
</body>
</html>

Example Vue Remove Last Comma from a string

Vue JS Remove Last Comma from a string

vue_str = vue_str.replace(/,\s*$/, "");

Angular 6 CRUD Operations Application Tutorials

My Paka Knowledgeable Ideas, Tips and Tricks, Useful Content, Jobs, Technology, Earn Money, gmail creation, skype, yahoo and more useful things.

Read Also:  QueryException in laravel 6 Exception Handling

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.


I hope you get an idea about Vue.js Remove Last Char from String.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.