Results 1 to 6 of 6

Thread: Few functions

  1. #1

    Joined
    Jan 2012
    Posts
    17
    Userbars
    0
    Thanks
    8
    Thanked
    14/4
    DL/UL
    47/2
    Mentioned
    22 times
    Time Online
    7d 6h 18m
    Avg. Time Online
    2m

    Few functions

    Listbox threading for real-time log:


    Check if data folder/any text files exist and if they don't create them (example uses 1 text file):



    Split word into 2 variables (for example username:password):


  2. The Following 2 Users Say Thank You to Coolguy For This Useful Post:

    j03 (08-15-2015),npm (08-14-2015)

  3. #2
    Zachafer's Avatar
    Joined
    Dec 2011
    Posts
    1,235
    Userbars
    11
    Thanks
    769
    Thanked
    1,466/678
    DL/UL
    98/0
    Mentioned
    512 times
    Time Online
    24d 13h 9m
    Avg. Time Online
    8m
    For the last function, you only want to split the string once. Your example wouldn't parse a password that contained a colon :

  4. #3
    Saiyan Race
    j03's Avatar
    Joined
    Dec 2011
    Posts
    13,722
    Userbars
    166
    Thanks
    5,907
    Thanked
    33,078/6,609
    DL/UL
    23/36
    Mentioned
    3,867 times
    Time Online
    563d 5h 38m
    Avg. Time Online
    3h 13m
    Here is how I do a split in C#.NET:

    Code:
    string splitMe = "username:password";
    string[] splitData = splitMe.ToString().Split(":".ToArray());
    
    //username is stored in splitData[0]
    //password is stored in splitData[1]
    @(you need an account to see links) @(you need an account to see links)
    (you need an account to see links)
    (you need an account to see links)(you need an account to see links)

    ------------------------
    [02/24/2013] Stealth CORE is made into the first standalone Neopets auto-player.
    ------------------------


  5. The Following User Says Thank You to j03 For This Useful Post:

    Coolguy (08-19-2015)

  6. #4
    Zachafer's Avatar
    Joined
    Dec 2011
    Posts
    1,235
    Userbars
    11
    Thanks
    769
    Thanked
    1,466/678
    DL/UL
    98/0
    Mentioned
    512 times
    Time Online
    24d 13h 9m
    Avg. Time Online
    8m
    Quote Originally Posted by Infamous Joe View Post
    Here is how I do a split in C#.NET:

    Code:
    string splitMe = "username:password";
    string[] splitData = splitMe.ToString().Split(":".ToArray());
    
    //username is stored in splitData[0]
    //password is stored in splitData[1]
    @(you need an account to see links) @(you need an account to see links)
    Ok but what if the password contains a colon? (A perfectly valid password character)
    Code:
    string splitMe = "username:pas:sword";
    string[] splitData = splitMe.ToString().Split(":".ToArray());
    
    //username is stored in splitData[0]
    //password is stored in splitData[1] AND splitData[2]

  7. #5
    Saiyan Race
    j03's Avatar
    Joined
    Dec 2011
    Posts
    13,722
    Userbars
    166
    Thanks
    5,907
    Thanked
    33,078/6,609
    DL/UL
    23/36
    Mentioned
    3,867 times
    Time Online
    563d 5h 38m
    Avg. Time Online
    3h 13m
    Quote Originally Posted by Zachafer View Post
    Ok but what if the password contains a colon? (A perfectly valid password character)
    Code:
    string splitMe = "username:pas:sword";
    string[] splitData = splitMe.ToString().Split(":".ToArray());
    
    //username is stored in splitData[0]
    //password is stored in splitData[1] AND splitData[2]
    Probably need a new separator OR write a function that specifically targets splitting the string where you utilize the length of the username while getting the password (for strings with birthdays added), otherwise you can just split the string once.
    (you need an account to see links)
    (you need an account to see links)(you need an account to see links)

    ------------------------
    [02/24/2013] Stealth CORE is made into the first standalone Neopets auto-player.
    ------------------------


  8. #6
    Zachafer's Avatar
    Joined
    Dec 2011
    Posts
    1,235
    Userbars
    11
    Thanks
    769
    Thanked
    1,466/678
    DL/UL
    98/0
    Mentioned
    512 times
    Time Online
    24d 13h 9m
    Avg. Time Online
    8m
    Code:
    string splitMe = "username:pas:sword";
    string[] splitData = splitMe.Split(new char[] { ':' }, 2);
    
    //username is stored in splitData[0]
    //password is stored in splitData[1]

  9. The Following 2 Users Say Thank You to Zachafer For This Useful Post:

    Coolguy (08-19-2015),j03 (08-18-2015)

Posting Permissions

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