L
L
LoliNeko2015-07-01 09:59:26
Lua
LoliNeko, 2015-07-01 09:59:26

How to replace the letters a, o, e in one line at the same time from Russian to English and vice versa?

s = 'hello hello hello hello'
How to change e in hello to Russian e in this string, and vice versa in the word hello to English e. (an example with several letters a, e, o is desirable)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
andreyv, 2015-07-05
@andreyv

In PHP you can do this:

$oldText = 'hello привет hello привет';
$newText = str_replace(
    array('a', 'e', 'o', 'а', 'е', 'о'),
    array('а', 'е', 'о', 'a', 'e', 'o'),
    $oldText
);
echo $newText;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question