Ralle
Owner
- Joined
- Oct 6, 2004
- Messages
- 10,183
Hello guys, just wanna show off what I have spent THE LAST 3 HOURS doing:
I am going to port some of the basic but powerful functions from PHP to JASS.
JASS:
// mostly for debugging, outputting a string to all players by not writing much
function echo takes string text returns nothing
call DisplayTextToForce( GetPlayersAll(), text )
endfunction
//
// input a single character and it returns if it is an integer or not
function isInt takes string input returns boolean
local integer i=0
local boolean r=false
if StringLength(input) == 1 then
loop
exitwhen i>9
if input == I2S(i) then
set r=true
endif
set i=i+1
endloop
endif
return r
endfunction
//
// returns all the numbers in a string as an integer
function phpIntval takes string input returns integer
local integer i=0
local string end=""
// loop through characters
loop
exitwhen i > StringLength(input)
if isInt(SubString(input,i,i+1)) then
set end = end + SubString(input,i,i+1)
endif
set i = i + 1
endloop
return S2I(end)
endfunction
I am going to port some of the basic but powerful functions from PHP to JASS.