Jump to content

Converting a string to an acceptable URL


tHud

Recommended Posts

Hello :)

I would like to convert a database 'product title' field into an URL.

 

The part that I am concerned about is the product title itself.

 

Typically, it would look something like this...

 

Something® FA and Something™ ABC

 

or

 

Blaster® Demand Valve

 

Would it be acceptable to simply replace the spaces with underscores?

Or should I be looking into removing the ™ and ® (and other characters)?

 

In which case, ideally I would need...

 

Something® FA and Something™ ABC  = something_FA_and_something_ABC

 

and

 

Blaster® Demand Valve = blaster_demand_valve

 

...but I wouldn't have a clue how to capture all such oddities.

 

Is there perhaps a function that 'helps' with this sort of thing? Or is it down to regular expressions only?

 

Thanks for any help :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.