Exploding string
#1

Hello, I have a string like
"Hello||Sup||Nothing, wbu?||Just chilling", and I want to use the || as a delimiter, and loop through each to
Код:
SendClientMessageToAll(-1, "Hello");
SendClientMessageToAll(-1, "Sup");
SendClientMessageToAll(-1, "Nothing, wbu?");
etc..
The amount of messages is fluctuating. I haven't scripted on SA-MP for several years, so I am extremely rusty. Something like PHP's explode function.

In PHP, it's
Код:
<?php

	$string = "Hello||Sup||Nothing, wbu?||Just chilling";

	$messages = explode("||", $string);

	foreach($messages as $message)
	{
		echo $message . "<br>";
	}

?>
which outputs

Код:
Hello
Sup
Nothing, wbu?
Just chilling
Any help would be appreciated, thanks.
Reply


Messages In This Thread
Exploding string - by Chriham3 - 02.10.2015, 16:59
AW: Exploding string - by Kaliber - 02.10.2015, 17:07
Re: Exploding string - by Lordzy - 02.10.2015, 17:26
Re: Exploding string - by Vince - 02.10.2015, 17:41

Forum Jump:


Users browsing this thread: 2 Guest(s)