Hello,
I came across a mailing list post asking about converting a double to a int
or string and the answer at the time was to use a regex to lop off the
.00000 and save the lefthand side. I'm using the latest 3.5.x version and
can't seem to get this to work. Here's what I have:

<nop>
  <action>
    <assign assign_to="1" value="100" />
  </action>
</nop>

<nop>
  <action>
    <log message="Counter is [$1]"/>
  </action>
</nop>

<!-- couldn't get it to work and saw line in docs about it only working on
string vars, so tried to get the double into a string first -->

  <nop>
    <action>
      <assignstr assign_to="4" value="[$1]" />
    </action>
  </nop>

  <nop>
    <action>
      <ereg regexp="([0-9]{3})\.0+" search_in="var" variable="4"
assign_to="3"/>
    </action>
  </nop>

<nop>
  <action>
    <log message="Post regex: Counter is [$1] - String is [$4] - User is
[$3]"/>
  </action>
</nop>

The result of the above is:

Counter is 100.000000
Post regex: Counter is 100.000000 - String is 100.000000 - User is
100.000000

I tried various regex strings, I even went as far as just putting
"(100)\.000000"
to no avail.

Am I doing something wrong, or is this just not going to work?

Thanks!
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Sipp-users mailing list
Sipp-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sipp-users

Reply via email to