You can write your own functions in Google Sheets, so you can put your very own slugify
function:
function normalize(input) {
/*
* Normalize text in multiple cells
*/
if (input.map) {
// Test whether input is an array.
// https://developers.google.com/apps-script/guides/sheets/functions#optimization
// Recurse over array if so.
return input.map(slugify);
} else {
let normalized = input.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
normalized = normalized.replace('Ł', 'L').replace('ł', 'l')
return normalized
}
}
function slugify(input) {
/*
* Slugify text in multiple cells
*/
if (input.map) {
return input.map(slugify);
} else {
slug = normalize(input).toLowerCase();
return slug.replace(/\s+/g, '-');
}
}
It will work with arrays 🙂
Thx @khushalbokadey for the hint and Lewis Diamond for pointing out the normalize function.
You must be logged in to post a comment.