Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> zaiana stringów
Black-Berry
post
Post #1





Grupa: Zarejestrowani
Postów: 663
Pomógł: 6
Dołączył: 3.06.2007
Skąd: Kraków

Ostrzeżenie: (0%)
-----


Mógłby ktoś podpowiedzieć funkcję która zamienia stringi:
  • 'Db_Driver' => 'dbDriver';
  • 'Settings' => 'settings';
  • 'System_Driver_Abstract' => 'systemDriverAbstract'
  • 'small_case_value' => 'smallCaseValue';


Ten post edytował Black-Berry 2.11.2008, 21:03:04
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
l0ud
post
Post #2





Grupa: Zarejestrowani
Postów: 1 387
Pomógł: 273
Dołączył: 18.02.2008

Ostrzeżenie: (0%)
-----


Przed chwilą napisałem sobie coś takiego:
  1. <?php
  2.  
  3. function strToMixedCase($string) {
  4.    while($pos = strrpos($string,'_')) {
  5.        $string = substr($string, 0, $pos).strtoupper($string[$pos+1]).substr($string,$pos+2);
  6.    }
  7.    $string[0] = strtolower($string[0]);
  8.    return $string;
  9. }
  10.  
  11. echo strToMixedCase('small_case_value');
  12.  
  13. ?>
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 9.10.2025 - 10:05