Reputation: 1893
I have functionality to upload image and in that image if image name have any single quotes or double quotes or white space then I got error to uploaded at amazon
So how to remove wild characters and spaces from image name?
Sorry one edit
I need to add %20 in place of white space
Please help me.
Upvotes: 0
Views: 6670
Reputation: 459
you can use gsub multiple times :
string.gsub(/"|'/, '').gsub(/\s/, '%20')
or use gsub! to change the original string like -
string.gsub!(/"|'/, '').gsub!(/\s/, '%20')
Upvotes: 1