Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi

 

I am interested in trying to find how out how to find the integer value of a string. We use this at work in ingres, so i am sure it can be done with VB.NET, i just dont know how :)

 

Thanks.

Posted

You can use the oldy VAL sentence:

'This will return an integer = 123
Val("123")
'So will this...
Val("123sdlfkjs")

'But note that this will still return an integer but = 0
Val("sdlfkjs123")

Alex :D

Software bugs are impossible to detect by anybody except the end user.
Posted

Thanks, but i tried that, but the integer returned was always 0, kind of negating the point of it.

 

The reason why i want to do this, is because we use this method to encrypt our passwords in our ingres programs, and i need to create a .NET interface, and it would be ideal if i could use the same mechanism.

Posted

It only returns 0(zero) if the numbers aren't at the begining of the string like I've shown in the examples...

Take a closer look at my examples...

 

If in other hand, you whant to retrieve numbers that are at other place on the String than the bigining it can be donne but with more lines of code...

 

Alex :D

Software bugs are impossible to detect by anybody except the end user.
Posted

  MsgBox(Val("34hello"))

 

Returns 34, whereas the true integer value is probably something like 467347887.

 

  MsgBox(Val("hello"))

 

Returns 0, where again the true integer value would be something nearer 3746473.

Posted

Ho ... now I got it...

 

You can use the:

"hello".GetHashCode

It retrieves an HashCode based on your String...

 

Alex :D

Software bugs are impossible to detect by anybody except the end user.
Posted
Thank you. That very very near to what i need. That does return an integer but not the same integer as UNIX returns for a test string. :(
Posted

Yeah... that's what I ask for...

Give us the exact sentence you use to generate that code in UNIX.

 

Alex :D

Software bugs are impossible to detect by anybody except the end user.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...