Skip to main content
Stack Overflow
  1. About
  2. For Teams

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Required fields*

How to parameterize/transliterate in Javascript?

In Ruby on Rails you can easily convert "any" text into a format which would work for subdomains/pathnames.

1) "I am nobody." -> "i-am-nobody"
2) "Grünkohl is a german word." -> "grunkohl-is-a-german-word"

I'd like to do this on the client-side for high responsiveness (alternative would be via Ajax).

The last example is called transliteration (converting Umlauts and other non-latin alphabets letters into latin ones). Transliteration would be a nice2have feature (in such cases I could fallback to Ajax to let Iconv do it).

Anybody knows how to do this with JavaScript? My current code works fine but has issues with multiple blank spaces, and Tête-à-tête becomes Tte--tte which is just ugly.

Answer*

Draft saved
Draft discarded
Cancel
0

lang-js

AltStyle によって変換されたページ (->オリジナル) /