Results 1 to 5 of 5

Thread: noobie VB6 question on splitting strings into single letters

  1. #1
    Senior Member UltraMagnus's Avatar
    Join Date
    Aug 2005
    Posts
    1,025
    Thanks
    24
    Thanked
    7 times in 7 posts

    Question noobie VB6 question on splitting strings into single letters

    hi, ok, i just started trying to program using VB6, anyhow, now, i understand how to split a string into an array of words that are seperated by spaces using the split command, but how do you split a string into an array of letters?

    thanks in advance!

  2. #2
    Seething Cauldron of Hatred TheAnimus's Avatar
    Join Date
    Aug 2005
    Posts
    17,164
    Thanks
    803
    Thanked
    2,152 times in 1,408 posts
    VB6 isn't a language i would recomend learning enless you've got a damn good reason too.

    but you can use the mid function to get a character in the middle of a string,

    not tested it (not got it installed, or used it for 4 years) but it should go like so

    DIM charArray() As char;
    for i = 0 to Len(inputString);
    charArray(i) = Mid(inputString,i,1);
    next i;
    throw new ArgumentException (String, String, Exception)

  3. #3
    Senior Member UltraMagnus's Avatar
    Join Date
    Aug 2005
    Posts
    1,025
    Thanks
    24
    Thanked
    7 times in 7 posts
    uh, basically, its the one that my school is using (at A level!), i know its crap, but i cant do fook all about it......

    ok, i think i got most of that inputstring is the string i want "cut up" (for want of a better word) do i need to change anything else? would you mind explaining how you have used the "mid" function there? i have never used it before...

    thanks!

  4. #4
    Seething Cauldron of Hatred TheAnimus's Avatar
    Join Date
    Aug 2005
    Posts
    17,164
    Thanks
    803
    Thanked
    2,152 times in 1,408 posts
    http://msdn2.microsoft.com/en-US/lib...29(VS.80).aspx

    that is the mid function. i specifies the "index" the start of the string.

    mid chops it up, and the 3rd paramater specifies the length, ie 1, so a single char.

    you familar with the for loop?
    throw new ArgumentException (String, String, Exception)

  5. #5
    Moderator DavidM's Avatar
    Join Date
    Jan 2005
    Posts
    8,779
    Thanks
    800
    Thanked
    252 times in 234 posts
    Oh crikey - this takes me back to writing a text paser about 20 years ago

    Yes, Mid is the ideal one for this case

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. single sided samsing ram question
    By Flash in forum PC Hardware and Components
    Replies: 4
    Last Post: 23-01-2004, 09:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •