| Yoko http://forum.yoko.com.ua/ |
|
| first letter of variable http://forum.yoko.com.ua/viewtopic.php?f=3&t=4371 |
Page 1 of 1 |
| Author: | virussino [ 2005-07-01 15:03:01 ] |
| Post subject: | first letter of variable |
hi how I can take the first letter of variable (ex: hola return h) ? tnx |
|
| Author: | virussino [ 2005-07-01 19:11:50 ] |
| Post subject: | |
sub test() var n=Left(3250,1) uo.print(str(n)) endsub return 0 why? |
|
| Author: | Beyonder [ 2005-07-01 20:48:49 ] |
| Post subject: | |
If you mean the first letter of variable's indentificator, than it is impossible. If it was about the wat that variable contains than this way: Code: sub Test() |
|
| Author: | virussino [ 2005-07-01 22:56:21 ] |
| Post subject: | |
mhh var b = 2500 var c = left(str(b),1) uo.print(c) # return 2 ok.. var d = c * 1000 # bad operation for this type of variable - D help |
|
| Author: | virussino [ 2005-07-01 23:47:12 ] |
| Post subject: | |
var c = val ( left(str(b),1) ) I do not resolve a problem.... I must approximate numbers with ", " for defect ex... 2,1 or 2,5 or 2,9 return 3 3,1 or 3,2 or 3,3 or 3,4 ecc.... 3,9 .... return 4 3,0 return 3 1,0 return 1 ecc ecc is possible? |
|
| Author: | Edred [ 2005-07-02 09:33:49 ] |
| Post subject: | |
Function Left() (or Right()) work with a string. You can't send value in this function. This function will return a string. You can't use operations multiple and divide (* and /) with a string. You need in convert the string to value. Code: VAR b = 3,2, c, d, e Try it. UO.Print() need in string parameter. If you send to this function a value - you can't get legal result. |
|
| Author: | Beyonder [ 2005-07-02 17:46:01 ] |
| Post subject: | |
Try this way: Code: sub RoundUp(Value) It works this way: int returns value without ','. That means that 3.0 = 3 and 3.9 = 3. Thats not exactly what we need. But what do we get after adding 0.9999 (count of '9' is equal to precision you need). 3.0 -> 3.9999 -> 3 3.1 -> 4.0999 -> 4 3.9 -> 4.8999 -> 4 Isn't that what we need? |
|
| Author: | virussino [ 2005-07-03 20:52:32 ] |
| Post subject: | |
perfect tnx :* |
|
| Page 1 of 1 | All times are UTC+02:00 |
| Powered by phpBB® Forum Software © phpBB Limited https://www.phpbb.com/ |
|