Announcement

Collapse
No announcement yet.

Parse Numeric string in Number

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Parse Numeric string in Number

    I need to parse a numeric string in a number!! How can I do?
    Ex:
    STRING: "5,16"
    Number (I need to use it to calculate other numbers!): 5,16

    Thx [img]/ubbthreads/images/icons/smile.gif[/img]

  • #2
    Re: Parse Numeric string in Number

    Not sure what your asking here, but take a look at the String.GetDelimitedString action. It works like this:

    %SecondNumber% = String.GetDelimitedString ("5,16", 1)

    %SecondNumber% would equal 16

    Comment


    • #3
      Re: Parse Numeric string in Number

      no... I have a numeric string!
      example:
      NUMERIC STRING: "16"
      I need to sum 2 to 16! But if I sum
      "16"+2 = "162"!! (Sum of string)
      I want to convert the string "16" to a number 16 so the sum 16+2 = 18! (Sum of number)
      It's like Integer.parse("162") in JAVA!!

      Comment


      • #4
        Re: Parse Numeric string in Number

        AMS doesn't really have a variable type. Simply use the evaluate function (check box below the text box) in the Set Variable actions

        %SUM% = Evaluate (16 + 2)

        Comment


        • #5
          Re: Parse Numeric string in Number

          "16" + "2" will result in 18. There is no difference between numeric strings and numbers in AutoPlay.

          In fact, everything's a string internally, and it gets interpreted as a number/version/string at run time. All that matters is the operator you use.

          Note that if you try to add a number to a string, or add two numbers that aren't entirely numeric (like "16" + "2a" or something), then the values will be interpreted as strings.

          What is it you're trying to do, exactly?
          --[[ Indigo Rose Software Developer ]]

          Comment


          • #6
            Re: Parse Numeric string in Number

            You can use variables in the expression too...

            %Num1% = "16"
            %Num2% = "2"
            %Sum1% = Evaluate (%Num1% + %Num2%)
            %Sum2% = Evaluate (16 + 2)

            Comment


            • #7
              Re: Parse Numeric string in Number

              That's all right, it was a stupid problem: I had in input number like 5,16 or 7,00 etc...
              the "," can't be used in the number format (it need "."), so AMS viewed it as string!

              Thx again! [img]/ubbthreads/images/icons/smile.gif[/img]

              Comment

              Working...
              X
              😀
              🥰
              🤢
              😎
              😡
              👍
              👎