What way can someone show me using a formula would I be able to pull a substring out of a string.
So given a string such as this URL:
https://cdn.filestackcontent.com/QF1aQMDRTkeDKKdTHtQz
What I want is to extract “QF1aQMDRTkeDKKdTHtQz” into a variable (any thing that exists after the “/” character)
Nevermind i can just use LEFT_STRIP 33 characters to get to the “/” position
But what if the string lenght is variable?
To extract a substring from a string, you can use the substring()
function in JavaScript. This function takes two arguments: the start index and the end index of the substring you want to extract.
For example, if you want to extract the substring after the “/” character in the URL you mentioned, you can do it like this:
let url = "https://cdn.filestackcontent.com/QF1aQMDRTkeDKKdTHtQz";
// Find the position of the "/" character in the URL
let startIndex = url.indexOf("/") + 1;
// Extract the substring after the "/" character
let subString = url.substring(startIndex);
console.log(subString); // prints "QF1aQMDRTkeDKKdTHtQz"
If the length of the string is variable and you want to extract the substring after the “/” character, you can use the same logic as mentioned above and simply take the end index of the substring as the total length of the string.
For example:
let url = "https://cdn.filestackcontent.com/QF1aQMDRTkeDKKdTHtQz";
// Find the position of the "/" character in the URL
let startIndex = url.indexOf("/") + 1;
// Extract the substring after the "/" character until the end of the string
let subString = url.substring(startIndex, url.length);
console.log(subString); // prints "QF1aQMDRTkeDKKdTHtQz"
If you want to extract a substring of a fixed length after the “/” character, you can explicitly specify the end index of the substring. For example, if you want to extract a substring of 10 characters after the “/” character, you can do it like this:
let url = "https://cdn.filestackcontent.com/QF1aQMDRTkeDKKdTHtQz";
// Find the position of the "/" character in the URL
let startIndex = url.indexOf("/") + 1;
// Extract a substring of 10 characters after the "/" character
let subString = url.substring(startIndex, startIndex + 10);
console.log(subString); // prints "QF1aQMDRTk"
1 Like
Thanks,
I already figure it out using Javascript, but with appgyver itself is there any workaround?