Vue JS Get String Length Example

19-Mar-2021

.

Admin

Vue JS Get String Length Example

Hi Guys,

Today, I will learn you how to get string length in Vue js. we will show Vue js get string length example. you can easily get string length in vue.js. we can get Vue js to get string length using the ".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 }}

Example:


<!DOCTYPE html>

<html>

<head>

<title>How to get string length in Vue JS? - nicesnippets.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 nicesnippets.com"

}

})

</script>

</body>

</html>

It will help...

#Vue.Js

#Vue