Ver Mensaje Individual
  #6 (permalink)  
Antiguo 31/07/2009, 11:46
pochos
 
Fecha de Ingreso: julio-2009
Mensajes: 72
Antigüedad: 17 años, 3 meses
Puntos: 16
Respuesta: Buscar una mayuscula dentro de una palabra

A ver prueba esto...

Código PHP:
function limpiar_caracteres_especiales($string ){
$string = htmlentities($string);
$string = preg_replace('/\&(.)[^;]*;/', '\\1', $string);
return 
$string;
} 

$string = "El Coché es RojoThe Car is Red";
$i = 0;
$maxleng = strlen($string)-1;
$string_sce = limpiar_caracteres_especiales($string);
for(
$i=0;$i < $maxleng ;$i++){
    if((
$string_sce[$i] == strtoupper($string_sce[$i])) && ($string_sce[$i-1] != ' ') && ($string_sce[$i] != ' ') && $i != 0){
        
$pos_ini_ingles = $i;
        break;
    }
}
$texto_espanol = substr ($string , 0 , $pos_ini_ingles);
$texto_ingles = substr ($string , $pos_ini_ingles, $maxleng);