Forum FAQForum FAQSearchSearch MemberlistMemberlist Forum ignore listForum ignore list RegisterRegister ProfileProfile Log in to check your private messagesLog in to check your private messages Log inLog in
micanje hr znakova sa phpom

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side
View previous topic :: View next topic  
Author Message
snyder



Joined: 21 Dec 2005
Posts: 57
Location: Zagreb

PostPosted: 05.07.2007 20:27    Post subject: micanje hr znakova sa phpom Add user to your forum ignore list Reply with quote

eto, maximus se namucio dok je skuzio di je problem a ja cu napisati kako to ide, pa ako nekome zatreba... Smile
Code:

function miciHrZnakove($str) {
   $patterns[] = '/\x{17D}/u';# Z
   $patterns[] = '/\x{160}/u';# S
   $patterns[] = '/\x{110}/u';# D
   $patterns[] = '/\x{106}/u';# meko C
   $patterns[] = '/\x{10C}/u';# tvrdo C
   $patterns[] = '/\x{17E}/u';# z
   $patterns[] = '/\x{161}/u';# s
   $patterns[] = '/\x{111}/u';# d
   $patterns[] = '/\x{107}/u';# meko c
   $patterns[] = '/\x{10D}/u';# tvrdo c
   $replacements[] = 'Z';
   $replacements[] = 'S';
   $replacements[] = 'D';
   $replacements[] = 'C';
   $replacements[] = 'C';
   $replacements[] = 'z';
   $replacements[] = 's';
   $replacements[] = 'd';
   $replacements[] = 'c';
   $replacements[] = 'c';
   return preg_replace($patterns, $replacements, $str);
}
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
damir



Joined: 10 Jul 2004
Posts: 49

PostPosted: 24.07.2007 15:45    Post subject: Re: micanje hr znakova sa phpom Add user to your forum ignore list Reply with quote

snyder wrote:
eto, maximus se namucio dok je skuzio di je problem a ja cu napisati kako to ide, pa ako nekome zatreba... Smile
Code:

function miciHrZnakove($str) {
   $patterns[] = '/\x{17D}/u';# Z
   $patterns[] = '/\x{160}/u';# S
   $patterns[] = '/\x{110}/u';# D
   $patterns[] = '/\x{106}/u';# meko C
   $patterns[] = '/\x{10C}/u';# tvrdo C
   $patterns[] = '/\x{17E}/u';# z
   $patterns[] = '/\x{161}/u';# s
   $patterns[] = '/\x{111}/u';# d
   $patterns[] = '/\x{107}/u';# meko c
   $patterns[] = '/\x{10D}/u';# tvrdo c
   $replacements[] = 'Z';
   $replacements[] = 'S';
   $replacements[] = 'D';
   $replacements[] = 'C';
   $replacements[] = 'C';
   $replacements[] = 'z';
   $replacements[] = 's';
   $replacements[] = 'd';
   $replacements[] = 'c';
   $replacements[] = 'c';
   return preg_replace($patterns, $replacements, $str);
}




<?
echo iconv('UTF-8', 'ASCII//TRANSLIT', "¹ščę¾©ŠČĘ®);
?>

bi trebalo biti sdcczSDCCZ

_________________
pass the joint ...
Back to top
View user's profile Send private message Visit poster's website
retro_one



Joined: 16 Sep 2003
Posts: 880
Location: DUBRAVA.

PostPosted: 25.07.2007 08:47    Post subject: Re: micanje hr znakova sa phpom Add user to your forum ignore list Reply with quote

snyder wrote:
eto, maximus se namucio dok je skuzio di je problem a ja cu napisati kako to ide, pa ako nekome zatreba... Smile
Code:

function miciHrZnakove($str) {
   $patterns[] = '/\x{17D}/u';# Z
   $patterns[] = '/\x{160}/u';# S
   $patterns[] = '/\x{110}/u';# D
   $patterns[] = '/\x{106}/u';# meko C
   $patterns[] = '/\x{10C}/u';# tvrdo C
   $patterns[] = '/\x{17E}/u';# z
   $patterns[] = '/\x{161}/u';# s
   $patterns[] = '/\x{111}/u';# d
   $patterns[] = '/\x{107}/u';# meko c
   $patterns[] = '/\x{10D}/u';# tvrdo c
   $replacements[] = 'Z';
   $replacements[] = 'S';
   $replacements[] = 'D';
   $replacements[] = 'C';
   $replacements[] = 'C';
   $replacements[] = 'z';
   $replacements[] = 's';
   $replacements[] = 'd';
   $replacements[] = 'c';
   $replacements[] = 'c';
   return preg_replace($patterns, $replacements, $str);
}


iskreno nije mi jasno zasto koristis preg_replace funkciju kad bi najobicnija i brza str_replace funkcija isto odradila posao...

_________________
Just your average eccentric programmer.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group