18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

How to know the length of a Variable.

AkhilsAkhils Members
edited November -1 in Sahi - Open Source
How to know the length of a Variable. I have tried following codes:


$tamnt = new Array();
_set($len, $tamnt.length);


assuem $tamnt=6495
we need the length of $tamnt
the answer is 4


and
this one also

_set($len, ($tamnt).length);

Please correct my codes.

Comments

  • AkhilsAkhils Members
    Any updates on this......
  • narayannarayan Administrators
    $tamnt = 6495;
    $len = (""+$tamnt).length; //=4. you want the string length.

    Btw, how can $tamnt be an Array if it is equal to 6495?!
  • AkhilsAkhils Members
    Thanks Narayan it works.

    We are storing the number in an array and then later trying to calculate the string length.
Sign In or Register to comment.