How to get string length in Vue JS?

By Hardik Savani | July 16, 2019 | | 9461 Viewer | Category : Vue.JS


In this small example, i will share with you getting string length in vue js. you can easily get string length in vue.js. we can get vue js get string length using ".length" attribute.

It seems very easy, but sometime we need to get our string length or size at time we need to get length using vue js.

you can see bellow sample code:

{{ myString.length }}

You can see bellow full example:

Example:

<!DOCTYPE html>

<html>

<head>

<title>How to get string length in Vue JS? - ItSolutionStuff.com</title>

<script src="https://cdn.jsdelivr.net/npm/vue"></script>

</head>

<body>

<div id="app">

<p>String : {{ myString }}</p>

<p>String Length : {{ myString.length }}</p>

</div>

<script type="text/javascript">

var app = new Vue({

el: '#app',

data: {

myString: "This is ItSolutionStuff.com"

}

})

</script>

</body>

</html>

I hope it can help you...



Tags : Example Vue.JS


Hardik Savani
My name is Hardik Savani. I'm a full-stack developer, entrepreneur and owner of Aatman Infotech. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.
Follow Me: Github Twitter
***Do you want me hire for your Project Work? Then Contact US.

We are Recommending you: