How to Replace part of String?
#1

How to Replace part of String?
For example string "I'm going to work."
find "work" and reaplace with "school".
new string "I'm going to school."
Reply
#2

I'm on my phone at the moment so if it doesn't work right i'm sorry.

pawn Код:
if(strfind("Im going to work", "work", true) != -1)
{
SendClientMessageToAll(Color here, "Im going to school");
}
Reply
#3

I want to replacve unknow string with for example "|", find "|" and repleace with "\n|"....
Reply
#4

Could you explain it a little more please.
Reply
#5

You can use 'strdel' & 'strfind' & 'strins'

Try to compile and start this... (: example...
pawn Код:
public OnGameModeInit()
{
    new wii[30] = "I'm going to work";
    print(wii);
    strdel(wii,13,17);
    print(wii);
    strins(wii, "school", 13);
    print(wii);
    return 1;
}
Reply
#6

I have unknow string with for exapmle this symbols "|", i want to replace every symbol with "\n|" and to place that whole replaced string into another...
Reply
#7

Anyone?
I'm geting dini (get_Dini) with some comments, and i don't know the content of that dini, but i know that comments are separated by "|" and i want to use that simbol, to replace it ("\n|") and to make every comment in new line. And at the end to put that string into other string with other content, but that does not matter.
Understand?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)