scripting@wanadoo.nl




Str()

http://www.scriptlogic.com/kixtart/FunctionLibrary_FunctionList.aspx


actual FunctionLibrary list on 'Scriptlogic' site printer-friendly mirror of UDF topic on 'scripting@wanadoo.nl' site close
11 December 2002 Str()
AuthorSophic
Action Returns any numeric expression as a string.
SyntaxStr (number) 
Parameters
  • number (Required / Integer) value to convert 
  • RemarksI created this simple function because kixtart doesn't like outputting numeric values combined with strings if the first value is numeric.
    eg:
    $number=20
    $text=" units"
    ?$number+$text
    outputs "20" not "20 units".

    This function helps to predict the amount of characters used to display a number for formatting purposes for instance.
    I looked for a built in Str() function but alas no! You could use ?""+$num+$text or $result=""+$num+$text if your script is short but the function helped me to avoid missing such errors. 
    ReturnsString value 
    DependenciesNone. 
    Examples
    ?str(100+100)+" percent"
    ;returns "200 percent"
    
    $number=9999
    ?len(str($number)+" Items")
    ;returns 10
    
     
    Source
    FUNCTION Str ($expn)
      ;convert number value to string value
      $str=""+$expn
    ENDFUNCTION ; - Str -
     
      original source of UDF topic. show actual FunctionLibrary list on Scriptlogic site close top
              printer-friendly mirror of UDF topic on scripting@wanadoo.nl site  




    Copyright © 2003 www.scriptlogic.com & scripting@wanadoo.nl - last updated on 20 May 2003


    Site Meter