|
|
|
| 11 December 2002 | Str() |
| Author | Sophic |
| Action | Returns any numeric expression as a string. |
| Syntax | Str (number) |
| Parameters | |
| Remarks | I 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. |
| Returns | String value |
| Dependencies | None. |
| 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 - |
|
|
|