Results 1 to 4 of 4

Thread: String to integer

  1. #1
    Private First Class
    Join Date
    Dec 2012
    Posts
    127
    Thanks
    132
    Thanked 114 Times in 63 Posts

    String to integer

    Hey,
    Is it possible to convert string to integer in CoD2 using stock functions ?

    Here is example using Java, hope it is similar in CoD2.

    PHP Code:
    String string "1234";
    int num Integer.parseInt(string); 
    Thanks in advance,
    Jeplaa

  2. #2
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    Quote Originally Posted by Jeplaa View Post
    Hey,
    Is it possible to convert string to integer in CoD2 using stock functions ?

    Here is example using Java, hope it is similar in CoD2.

    PHP Code:
    String string "1234";
    int num Integer.parseInt(string); 
    Thanks in advance,
    Jeplaa
    http://znation.nl/cod4script/int.htm

    Int( <value> )
    Module: Math

    Summary:
    Casts a floating point number or a string to an integer

    Example:
    x = Int( self.HUDHealthHeight );

    Required Args:
    1 : <value> A string or floating point number to cast to an integer

  3. The Following User Says Thank You to Mitch For This Useful Post:

    Jeplaa (24th February 2014)

  4. #3
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by Jeplaa View Post
    Hey,
    Is it possible to convert string to integer in CoD2 using stock functions ?

    Here is example using Java, hope it is similar in CoD2.

    PHP Code:
    String string "1234";
    int num Integer.parseInt(string); 
    Thanks in advance,
    Jeplaa
    yeah, there has been a stock function since the very first COD:

    PHP Code:
    int( string ); 
    FYI - the function in COD1 and UO took this form:

    PHP Code:
    (int)( string); 
    Last edited by Tally; 24th February 2014 at 11:44.

  5. The Following User Says Thank You to Tally For This Useful Post:

    Jeplaa (24th February 2014)

  6. #4
    Private First Class
    Join Date
    Dec 2012
    Posts
    127
    Thanks
    132
    Thanked 114 Times in 63 Posts
    Ohh got it, tried this function but made fault in code

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •