What is the split method in Ionic for?

Asked

Viewed 153 times

0

Well, I’m developing an app with Ionic 3, and I hear about a method called split, but I never understood its functionality. I just understood that it is related to arrays. Faced with this :

  • What is the split method?
  • How is its usability?

1 answer

0

The split() method divides a String object into an array of strings to separate string into substrings.

The split is not a function unique to Ionic, it is a function of javascript, but is present in several languages with some variations. It belongs to the object String and will always return an array of strings containing the values separated by the delimiter, equal to the explode php. Example

console.log("Batatinha quando nasce".split(' '))

The expected result is an array with each word separated by spaces.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split

Browser other questions tagged

You are not signed in. Login or sign up in order to post.