-1

How to extract substring from string and length of a string?

Dharman
  • 30,962
  • 25
  • 85
  • 135

2 Answers2

1

Well you can use the MDN website to search for those but here is what you asked for :

extract substring from string

The substring() method returns the part of the string between the start and end indexes, or to the end of the string.

const str = 'Stephano';

console.log(str.substring(1, 3));
// "te"
console.log(str.substring(2));
// "ephano"

length of a string

The length property of a String object contains the length of the string :

let string = "This is text !"
console.log(string.length)
// 14
Staxlinou
  • 1,351
  • 1
  • 5
  • 20
1

This is the file with the example functions. Now it works, thanks to the valuable advice

https://docs.google.com/spreadsheets/d/12jX8aAH5pkUYHFduBT8ueaebymcrACX0gdqBf5Xyl48/edit?usp=sharing

function cat(ma)
{
    ll = ma.length;
        
    return ll;
}

function tr(m)
{
    lll = m.substring(2,9);
        
    return lll;
}