Q:

substring

const str = 'substr';

console.log(str.substr(1, 2)); // (1, 2): ub
console.log(str.substr(1)); // (1): ubstr

/* Percorrendo de trás para frente */
console.log(str.substr(-3, 2)); // (-3, 2): st
console.log(str.substr(-3)); // (-3): str
3
// the substring method returns a string out of another string

const str = 'Mozilla';

console.log(str.substring(1, 3));
// expected output: "oz"

console.log(str.substring(2));
// expected output: "zilla"
17
var str = "Hello world!";
var res = str.substring(1, 4); //ell
29
SELECT SUBSTRING('SQL Tutorial', 1, 3) AS ExtractString;
7
var str = "Hello world That is reallly neat!";
var res = str.substring(0, 5);//get first 5 chars
0
const str = 'Mozilla';

console.log(str.substring(1, 3));
// expected output: "oz"

console.log(str.substring(2));
// expected output: "zilla"
4
const string = "0123456789";
console.log(string.slice(0, 2)); // "01"
console.log(string.slice(0, 8)); // "01234567"
console.log(string.slice(3, 7)); // "3456"
1

var str = "Hello world!";

var res = str.substr(1, 4); 
4
public String firstTwo(String str) {
    return str.length() < 2 ? str : str.substring(0, 2);
}
0
SELECT SUBSTRING('SQLTutorial.org');
0

New to Communities?

Join the community