Remove Last Comma from String in Vue.js

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

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*$/, "");

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

I hope you get an idea about Vue.js Remove Last Char from String.


#vue #vuejs 

Remove Last Comma from String in Vue.js
1.60 GEEK