substring string code example

Example 1: substring javascript

var str = "Hello world!";
var res = str.substring(1, 4); //ell

Example 2: substring

const str = 'Mozilla';

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

console.log(str.substring(2));
// expected output: "zilla"

Example 3: javascript substring

// zero-based index, 'end' is excluded from result
myString.substring( start, end )

Example 4: substring

# Python3 program to Remove repeated 
# unordered sublists from list
  
def Remove(lst):
     return ([list(i) for i in {*[tuple(sorted(i)) for i in lst]}])  
       
# Driver code
lst = [[1], [1, 2], [3, 4, 5], [2, 1]]
print(Remove(lst))

Tags: