Visualizzazione dei risultati da 1 a 4 su 4

Hybrid View

  1. #1
    Utente di HTML.it L'avatar di badaze
    Registrato dal
    Jun 2002
    residenza
    Lyon
    Messaggi
    5,373
    Forse non ho letto bene, ma penso si potrebbe rimpiazzare gran parte del codice di doHYPEN con

    Codice PHP:
                    $hyphen[0]=substr($string0$n+1);
                    if (
    $a != " ") { $hyphen[0] .="-";}                
                    
    $hyphen[1]=substr($string$n+1);                
                    return 
    $hyphen
    Ridatemi i miei 1000 posts persi !!!!
    Non serve a nulla ottimizzare qualcosa che non funziona.
    Cerco il manuale dell'Olivetti LOGOS 80B - www.emmella.fr

  2. #2
    Quote Originariamente inviata da badaze Visualizza il messaggio
    Forse non ho letto bene, ma penso si potrebbe rimpiazzare gran parte del codice di doHYPEN con

    Codice PHP:
                    $hyphen[0]=substr($string0$n+1);
                    if (
    $a != " ") { $hyphen[0] .="-";}                
                    
    $hyphen[1]=substr($string$n+1);                
                    return 
    $hyphen
    prima vanno però verificate le condizioni e dopo se soddisfatte si tronca la parola
    si potrebbe rifare il codice così:

    Codice PHP:
    function doHYPHEN($string$start){
        
    $len=strlen($string);
        for(
    $n=$start;$n<$len-1;$n++){
            
    $a=strtolower($string{$n});
            
    $b=strtolower($string{$n+1});
            
    $c=strtolower($string{$n+2});
            if((!
    isN($a) and !isN($b)) or $a!="s"){
                if(
    $a==" "){//è uno spazio
                    
    $hyphen[0]=substr($string0$n+1);
                    
    $hyphen[1]=substr($string$n+1);
                    return 
    $hyphen;
                }
                if((
    $a==$b and $n<$len-and $c!=" ") or (isV($a) and $b=="s") or (isL($a) and $b=="s") or (isV($a) and isC($b) and isV($c)) or (isV($a) and isC($b) and isL($c)) or (isL($a) and isC($b) and isV($c)) or (isL($a) and isC($b) and isL($c)) or (isV($a) and isL($b) and isV($c)) or (isL($a) and isL($b) and isV($c))){
                    
    $hyphen[0]=substr($string0$n+1)."-";
                    
    $hyphen[1]=substr($string$n+1);
                    return 
    $hyphen;
                }
            }
        }
        
    $hyphen[0]=$string;
        return 
    $hyphen;

    più che altro era per comodità di lettura del codice

Tag per questa discussione

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.