select before and after text - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: select before and after text (
/showthread.php?tid=510018)
select before and after text -
ic3cr3am - 29.04.2014
How would i get text before and after a character....
For example
How would i get text before and after ',' (comma)
Re: select before and after text -
BroZeus - 29.04.2014
not sure just made this not tested but might work
pawn Код:
#define Seprate "hello,ic3_cr3am"// storing the variable to seprate
new pos=strfind(Seprate, ",", true);//finding how far comma is from start
new str1[30],str2[30];
strmid(str1,SEPRATE,0,pos);//extracting characters before comma that will be stored in str1
strmid(str2,SEPRATE,pos+1,strlen(SEPRATE));//extracting characters after comma that will be stored in str2
Re: select before and after text -
Vince - 29.04.2014
Or simply:
pawn Код:
sscanf(text, "p<,>s[16]s[16]", part1, part2)
Re: select before and after text -
iFarbod - 29.04.2014
if this is with PHP use preg_match!