Solved

String manipulation

Posted on 2009-04-11
3
187 Views
Last Modified: 2012-05-06
Hi,

I would like to transform a string into a dashed url in lower case, e.g.

L'évènement Xyz

should be

l-evenement-xyz

(note that I need to get rid of the accents, like é, è, ë, ê, ô, ö, ù, û, ü , î, ï, à, â, ä
also quotes may appear like the example above, but also !, ?, :,  etc. )

Thank you for any help.
0
Comment
Question by:matthew_be
3 Comments
 
LVL 5

Accepted Solution

by:
niko86 earned 115 total points
ID: 24123371
you could use strtr to translate characters
eg:
$yournewstring = strtr($yourstring, "()!$'?: ,&+-/.`R}aS~x¥µÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿ",
     "--------------SOZsozYYuAAAAAAACEEEEIIIIDNOOOOOOUUUUYsaaaaaaaceeeeiiiionoooooouuuuyy");

Open in new window

0
 

Author Comment

by:matthew_be
ID: 24123598
Experts Exchange have some problem with the encoding,
e.g. in your code you replace 'a' by 's',
but I know Experts Exchange replaces some characters.


Thank you !
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question