How to set a ' - ' betwen number phone ? (470-605) - 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: How to set a ' - ' betwen number phone ? (470-605) (
/showthread.php?tid=575230)
How to set a ' - ' betwen number phone ? (470-605) -
Metharon - 24.05.2015
I want my number to be 417-364
Do somebody have a string function that set a ' - ' between the numbers?
Re: How to set a ' - ' betwen number phone ? (470-605) -
Bingo - 24.05.2015
DELETE.
Re: How to set a ' - ' betwen number phone ? (470-605) -
Macluawn - 24.05.2015
Assuming that all phone numbers are 6 digits long and stored as an integer, you can just use mod and division:
- phone / 1000 to get the first 3 digits.
- phone % 1000 to get the last 3 digits.
and then you can output them with an delimiter you want.
Or if the length is unknown and you dont want to do any fancy math tricks, look into
strins.
Re: How to set a ' - ' betwen number phone ? (470-605) -
Kyle - 24.05.2015
strins(string, "-", 3);