We have updated our Terms of Service, Code of Conduct, and Addendum.

How do I turn a string field value to an integer?

I need to turn a string field value into an integer, how do I do that?

Best Answer

Answers

  • pie
    pie Posts: 22 ✭✭
    edited July 2023 Answer ✓

    The Numerify Function converts event fields that are numbers to type number .

    docs.cribl.io

    Numerify | Cribl Docs

    Extract numeric values from event fields

  • Brendan Dalpe
    Brendan Dalpe Posts: 201 mod

    Another way to do this with JavaScript code is to use the Number class or the Unary plus operator.

    Number(field) or +field are equivalent.

    If you have a hexadecimal number, you can use the Number.parseInt() function to convert from base 16 to base 10 (decimal).

    Number.parseInt(field, 16)