Neverworld Grid

You are not logged in. Would you like to login or register?

6/25/2019 6:32 pm  #1

Check if input is a INTEGER - ideal to include in your preprocessor

Method to check if a given string can be typecast to an INTEGER. Use independently or add the method to your LSL preprocessor folder and add an include statement to your script. 

#include "chkisint.lsl"
integer isInt = ChkIsInt (string inputString)

integer ChkIsInt (string inputString)
{ // returns true if the supplied string is an integer and false if its not
    integer isInt;
    integer chkInt = (integer)inputString;
    string chkStr = (string)chkInt;
    if (inputString == "") isInt = FALSE;
    else if (chkStr == inputString) isInt = TRUE;
            isInt = FALSE;
    return isInt;

Last edited by sara (6/26/2019 3:45 am)


Board footera


Powered by Boardhost. Create a Free Forum