Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

VB.NET Question

Options
  • 13-04-2006 4:17pm
    #1
    Registered Users Posts: 8,676 ✭✭✭


    Ok I have question for the VB.NET experts, is it possible to split an incoming string from a client application into 3 separate integers.


Comments

  • Closed Accounts Posts: 3,357 ✭✭✭Beano


    what does the incoming string look like?


  • Registered Users Posts: 8,676 ✭✭✭Chong


    Ok the incoming string is like this: 0|20|23.


  • Closed Accounts Posts: 884 ✭✭✭NutJob


    Use a regular expression

    http://www.regular-expressions.info/dotnet.html or MSDN if u can actually find it in there?


    and then parse the array to vaues you want

    Integer.Parse(), CInt(), etc.


  • Registered Users Posts: 8,676 ✭✭✭Chong


    I am really sorry but can u help me a little furhter nutjob m8. I am a complete n00b at .net and VB in general. Its an assignment and up till now we have only been inputing vb.net code without actually leanring it.


  • Closed Accounts Posts: 4,943 ✭✭✭Mutant_Fruit


    Willem D wrote:
    up till now we have only been inputing vb.net code without actually leanring it.
    Thats your own fault now isn't it? Well, he could give you the code, and then you'd just insert it again without learning it. Look up that info, and come back with questions.

    Try splitting the string using the char '|'.


  • Advertisement
  • Registered Users Posts: 8,676 ✭✭✭Chong


    Oi oi mutant fruit, the lecturer has from october given us 9 assignments where he wud give us 8 pages of code to enter, it is an easy way to allocate practical marks. We have never been thought how it works, we are just told enter that code each time and hand it up at the end of the class. Nuthin about VB.Net has ever been explained to us like.

    I have tryed splitting the string , all I need now is to parse the elements of an array in to separate integers.


  • Closed Accounts Posts: 4,943 ✭✭✭Mutant_Fruit


    linky
    That should provide all the info ya need to do it. If you do have problems using the function, let us know what the problem is.


  • Registered Users Posts: 8,676 ✭✭✭Chong


    Thanks for the excellent link Mutant_Fruit , I reallly do appreciate it.

    In case u didnt realise I am being sarcastic.


  • Closed Accounts Posts: 884 ✭✭✭NutJob


    http://visualbasic.about.com/od/usingvbnet/l/blregexa.htm

    has step by step guide

    Regex.Split(strText,"") ' Reg exp goes in part 2 removed due to sarcasm

    My advice is post ur code and ill tell u where u go wrong but the rules on this forum is i cant write the code for you

    use Integer.Parseint(array[elementNo]) 'not removed but thinkin about it'

    i cant do much mor for u but u will need the above link to tie all this together

    and iv stripped out details because u were sarcastic to mutant fruit


  • Registered Users Posts: 8,676 ✭✭✭Chong


    Thanks NutJob mate for all the USEFUL help , unlike others.

    Thanks again Nuthjob.


  • Advertisement
  • Closed Accounts Posts: 4,943 ✭✭✭Mutant_Fruit


    Well, if he had even bothered to look at the first link in google, he would have gotten the answer. It was a good explanation of how to convert a string to an int. It even gave two different methods!

    He could have used Int.Parse(), or Convert.ToInt32() (or even Int.TryParse() incase there was a problem parsing the int)!

    Of course, he was far to lazy to even notice that the first link in google linked to a guy asking:
    I need to convert a string of 1234 to an INT of 1234 so I can use it a
    vbscript sql query. Got clues?
    All i can say is, you're going to fail the year if you can't look up google and insist on continuing the old copy-paste mentality.


  • Registered Users Posts: 8,676 ✭✭✭Chong


    Christ Mutant_Fruit , point taken. Apart from that let me say yet again , we dont study VB.NET whatsoever , we are given the code by the lecturer at the start of a practical class each week. The code each week then in turn is expected to be input in an hour class. Sorry for being sarcastic btw.


  • Closed Accounts Posts: 884 ✭✭✭NutJob


    Thats the difference between college and secondry school.
    You have to do it urself lecturer is just there to help.

    Im afraid thats college unless i went to two bad colleges which i doubt.


Advertisement