Jay1b Posted January 2, 2004 Posted January 2, 2004 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. Quote
AlexCode Posted January 2, 2004 Posted January 2, 2004 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 Quote Software bugs are impossible to detect by anybody except the end user.
Jay1b Posted January 2, 2004 Author Posted January 2, 2004 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. Quote
AlexCode Posted January 2, 2004 Posted January 2, 2004 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 Quote Software bugs are impossible to detect by anybody except the end user.
Jay1b Posted January 2, 2004 Author Posted January 2, 2004 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. Quote
AlexCode Posted January 2, 2004 Posted January 2, 2004 Ho ... now I got it... You can use the: "hello".GetHashCode It retrieves an HashCode based on your String... Alex :D Quote Software bugs are impossible to detect by anybody except the end user.
Jay1b Posted January 2, 2004 Author Posted January 2, 2004 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. :( Quote
Jay1b Posted January 2, 2004 Author Posted January 2, 2004 For example the string 'q12345' (Cant remember if its a capital Q though!) equates to 7610981. Cheers. Quote
Administrators PlausiblyDamp Posted January 2, 2004 Administrators Posted January 2, 2004 Do you have any documentation / knowledge of how this value is obtained? What unix command are you using to generate this value? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
AlexCode Posted January 2, 2004 Posted January 2, 2004 Yeah... that's what I ask for... Give us the exact sentence you use to generate that code in UNIX. Alex :D Quote Software bugs are impossible to detect by anybody except the end user.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.