is it right?

susu

Well-Known Member
Licensed User
Longtime User
I have this code:

B4X:
Dim now As Long
Dim str As String

now = DateTime.Now
str = now
str.SubString2(0,5)
   
Msgbox(str, now)

Compiled without error but message box display the same number.

Ps: All I want is getting just 5 first numbers of milliseconds value.
 

specci48

Well-Known Member
Licensed User
Longtime User
Hello susu,

B4X:
str.SubString2(0,5)
returns a string but you did not assign it to any value, so str remains unchanged.

If SubString should also change the value of str you have to
B4X:
str = str.SubString2(0,5)


specci48
 
Upvote 0

susu

Well-Known Member
Licensed User
Longtime User
I got it. Thank you Specci48.

I'll remember not to copy exactly "IDE help" :D

attachment.php
 

Attachments

  • idehelp.jpg
    idehelp.jpg
    25.2 KB · Views: 311
Upvote 0
Top