Created
March 11, 2022 11:18
-
-
Save MarshySwamp/82f910aa69a7534838b30d30ab3ef5ad to your computer and use it in GitHub Desktop.
Remove %20 from folder name text string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Remove %20 character from folder name via RegEx */ | |
var inputFolder = Folder.selectDialog("Select the input folder:"); | |
alert("Original Folder Path:" + "\r" + inputFolder); | |
// Full path fsName + RegEx | |
var inputFSname = inputFolder.fsName.replace(/(?:.+\/)(.+)$/, '$1');; | |
alert("FS Name:" + "\r" + inputFSname.toSource()); | |
// Remove %20 space code via regex | |
var inputRegEx = inputFolder.name.replace(/%20/g, ' '); | |
alert("RegEx:" + "\r" + inputRegEx.toSource()); | |
/* Remove %20 character from folder name without RegEx */ | |
// Remove %20 space via decodeURI | |
var inputDecodeURI = decodeURI(inputFolder.name); | |
alert("Decode URI:" + "\r" + inputDecodeURI.toSource()); | |
// Remove %20 space via displayName | |
var inputDisplayName = inputFolder.displayName; | |
alert("Display Name:" + "\r" + inputDisplayName.toSource()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment