<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Convert String to Integer in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Convert-String-to-Integer/m-p/195636#M56409</link>
    <description>&lt;P&gt;You can fix that -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval myInt = tonumber(myString)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 19 Mar 2014 23:03:06 GMT</pubDate>
    <dc:creator>lguinn2</dc:creator>
    <dc:date>2014-03-19T23:03:06Z</dc:date>
    <item>
      <title>Convert String to Integer</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-String-to-Integer/m-p/195635#M56408</link>
      <description>&lt;P&gt;I have extracted a value out of expression but seems like it is still treated as String not integer and i cant do any math on it.&lt;BR /&gt;
For example before applying extraction the variable was : "0.05 %" - i extracted it to 0.05 but when i do any math on it it comes with blank value - as if splunk is not considering it as integer but as string - is that possible?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2014 22:45:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-String-to-Integer/m-p/195635#M56408</guid>
      <dc:creator>nikhilmehra79</dc:creator>
      <dc:date>2014-03-19T22:45:30Z</dc:date>
    </item>
    <item>
      <title>Re: Convert String to Integer</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-String-to-Integer/m-p/195636#M56409</link>
      <description>&lt;P&gt;You can fix that -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval myInt = tonumber(myString)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Mar 2014 23:03:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-String-to-Integer/m-p/195636#M56409</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2014-03-19T23:03:06Z</dc:date>
    </item>
    <item>
      <title>Re: Convert String to Integer</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-String-to-Integer/m-p/195637#M56410</link>
      <description>&lt;P&gt;Technically, this gives you a numeric not an integer though, which seems to be what the OP wanted. For those who come here looking for actual integers you likely need to eval your expression/field with round(), floor() or ceil() depending what sort of integer you need. For example, if you were calculating a row number from a sequence number you'd need something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval row=floor(seqno % numcols) | ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;See &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/CommonEvalFunctions#floor"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/CommonEvalFunctions#floor&lt;/A&gt; for more details.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2016 03:37:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-String-to-Integer/m-p/195637#M56410</guid>
      <dc:creator>enno</dc:creator>
      <dc:date>2016-06-16T03:37:20Z</dc:date>
    </item>
  </channel>
</rss>

