-2

I am trying to create a code to iterate through a save code, and I think it’ll be something like this :

Username;Password;Points

How can I split the above text into a list like this : [Username, Password, Points] ,everytime it finds a semicolon using Javascript?


Thanks in advance :)

KornLS
  • 85
  • 2
  • 7
  • 3
    Did you try the string method [`split`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split)? Maybe `str.split(';')`? If you did a search for "split text javascript" you would have come across all the documentation you needed. – Andy Aug 09 '21 at 07:19

1 Answers1

0

Just use split:

var input = "Username;Password;Points";
var parts = input.split(";");
console.log(parts);
Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360