0

In need to develope page like below 1

if(theString.length>100){
   theString = theString.substr(0,100)+'...';
}
Sven Eberth
  • 3,057
  • 12
  • 24
  • 29

1 Answers1

0

You can use the code like below to truncate the string variable:

function truncate(input, noOfChar) {
   if (input.length > noOfChar) {
      return input.substring(0, noOfChar) + '...';
   }
   return input;
};

Usage:

theString = truncate(theString, 100);
Ganesh Sanap
  • 1,386
  • 1
  • 8
  • 18