Jump to content
UBot Underground

Newbie: Replacing spaces with hyphens ( - )


Recommended Posts

I am scraping a page with products. Thanks to the great tutorial videos veteran users have been posting on Vimeo and YouTube, I've figured out how to download and name the image, but I need to know how to turn the product title to all lowercase and replace the spaces (if they exist) to "-". An example would be:

 

Product Title: Off The Wall

Resulting Product Image Name: off-the-wall.jpg

 

Thanks for any help!

Link to post
Share on other sites

Try this:

 

set(#title, "Off The Wall", "Global")

set(#title, $change text casing(#title, "Lower Case"), "Global")

set(#title, "{$replace(#title, " ", "_")}.jpg", "Global")

 

(take one line at a time, copy it and right click in your scripting area to paste. Right click on the words "drag commands here")

 

 

John

 

 

These commands can be combined, so let me know if you would rather have one less node.

Link to post
Share on other sites

Here is the combined code:

 

set(#title, "Off The Wall", "Global")

set(#title, "{$replace($change text casing(#title, "Lower Case"), " ", "_")}.jpg", "Global")

 

John

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...