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 :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.