Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Preslovljavanje iz LATINICE u Ћирилицу
String.prototype.lat2cir=function(){//preslovljavanje
return this.toString().replace(/A/g,"А").replace(/B/g,"Б").replace(/V/g,"В").replace(/G/g,"Г").replace(/DŽ/g,"Џ").replace(/Dž/g,"Џ").replace(/Đ/g,"Ђ").replace(/DJ/g,"Ђ").replace(/Dj/g,"Ђ").replace(/D/g,"Д").replace(/E/g,"Е").replace(/Ž/g,"Ж").replace(/Z/g,"З").replace(/I/g,"И").replace(/K/g,"К").replace(/LJ/g,"Љ").replace(/Lj/g,"Љ").replace(/L/g,"Л").replace(/M/g,"М").replace(/NJ/g,"Њ").replace(/Nj/g,"Њ").replace(/J/g,"Ј").replace(/N/g,"Н").replace(/O/g,"О").replace(/P/g,"П").replace(/R/g,"Р").replace(/S/g,"С").replace(/T/g,"Т").replace(/Ć/g,"Ћ").replace(/U/g,"У").replace(/F/g,"Ф").replace(/H/g,"Х").replace(/C/g,"Ц").replace(/Č/g,"Ч").replace(/Š/g,"Ш").replace(/a/g,"а").replace(/b/g,"б").replace(/v/g,"в").replace(/g/g,"г").replace(/dž/g,"џ").replace(/đ/g,"ђ").replace(/dj/g,"ђ").replace(/d/g,"д").replace(/e/g,"е").replace(/ž/g,"ж").replace(/z/g,"з").replace(/i/g,"и").replace(/k/g,"к").replace(/lj/g,"љ").replace(/l/g,"л").replace(/m/g,"м").replace(/nj/g,"њ").replace(/j/g,"ј").replace(/n/g,"н").replace(/o/g,"о").replace(/p/g,"п").replace(/r/g,"р").replace(/s/g,"с").replace(/t/g,"т").replace(/ć/g,"ћ").replace(/u/g,"у").replace(/f/g,"ф").replace(/h/g,"х").replace(/c/g,"ц").replace(/č/g,"ч").replace(/š/g,"ш");
};
//primer
var tekstLat="Đurđevak je cvet";
var tekstCir=tekstLat.lat2cir(); // "Ђурђевак је цвет"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment