Welcome Guest, Not a member yet? Register   Sign In
Character replacing inside a string
#2

[eluser]Jamie Rumbelow[/eluser]
Using str_replace you can't do it in one step - I'd suggest writing one function that looks for every letter and replaces them one by one. Someone else will probably suggest a much better performing solution but this will do:

Code:
function replace_all($string) {
    $string = str_replace('š', 's', $string);
    $string = str_replace('č', 'c', $string);
    $string = str_replace('é', 'e', $string);
    $string = str_replace('ü', 'u', $string);
    $string = str_replace('π', 'pi', $string);

    return $string;
}


Messages In This Thread
Character replacing inside a string - by El Forum - 12-05-2009, 10:13 AM
Character replacing inside a string - by El Forum - 12-05-2009, 10:30 AM
Character replacing inside a string - by El Forum - 12-05-2009, 10:32 AM
Character replacing inside a string - by El Forum - 12-05-2009, 11:10 AM
Character replacing inside a string - by El Forum - 12-05-2009, 11:13 AM
Character replacing inside a string - by El Forum - 12-05-2009, 06:00 PM



Theme © iAndrew 2016 - Forum software by © MyBB