Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- strtr(const str[], const from[], const to[])
- {
- new
- l_from = strlen(from),
- l_to = strlen(to),
- buf[128];
- if(l_from != l_to)
- return buf;
- new
- l_str = strlen(str);
- for(new i = 0; i < l_str; i++)
- {
- buf[i] = str[i];
- for(new f = 0; f < l_from; f++)
- if(buf[i] == from[f])
- {
- buf[i] = to[f];
- break;
- }
- }
- return buf;
- }