Quick actions

cmd+k|ctrl+k

Navigation

Languages

take growid from list cid

Snippet info

Language

JavaScript

Visibility

public

Author

fjrbgs

Created

2023-07-23T03:09:36.327056Z

Updated

2023-07-23T03:10:47.884686Z

const inputString = ``; //put here example : `izndgmfvidfik|HeavenGanteng1.:[email protected]|bbuSuX46`
// Split the input string by newline characters
const lines = inputString.split('\n');

// Extract the first part before the pipe separator for each line
const convertedLines = lines.map((line) => {
  const firstPart = line.split('|')[0];
  return `"${firstPart.trim()}"`; // Add double quotes around the first part and trim any leading or trailing whitespace
});

// Convert the array of lines back to a string, joining them with comma and newline characters
const convertedString = convertedLines.join(',\n');

console.log(convertedString);
INFO