GetBetween (get between two strings!)

Discussion in 'Programming General' started by Blupig, Nov 29, 2011.

GetBetween (get between two strings!)
  1. Unread #1 - Nov 29, 2011 at 10:45 PM
  2. Blupig
    Joined:
    Nov 23, 2006
    Posts:
    7,145
    Referrals:
    16
    Sythe Gold:
    1,609
    Discord Unique ID:
    178533992981594112
    Valentine's Singing Competition Winner Member of the Month Winner MushyMuncher Gohan has AIDS Extreme Homosex World War 3 I'm LAAAAAAAME
    Off Topic Participant

    Blupig BEEF TOILET
    $5 USD Donor

    GetBetween (get between two strings!)

    I use this function way too often in VB, C#, etc, whenever I'm parsing, and to my dismay I found nothing like it on Google, so I made my own.

    Voila:

    Code:
    string getBetween(string fullstring, string start, string end)
    {
    	int spos = fullstring.find(start) + start.length();
    	int epos = fullstring.find(end);
    
    	int length = (epos - spos);
    
    	return fullstring.substr(spos, length);
    }
    
    Uses the <string> header
     
  3. Unread #2 - Nov 29, 2011 at 10:58 PM
  4. iJava
    Joined:
    Nov 21, 2011
    Posts:
    1,197
    Referrals:
    11
    Sythe Gold:
    485
    Discord Unique ID:
    220055593568829441

    iJava .Previously known as RSGoldRush
    $200 USD Donor New

    GetBetween (get between two strings!)

    Nice work, so you're moving away from .Net languages?
     
  5. Unread #3 - Nov 29, 2011 at 11:57 PM
  6. Govind
    Joined:
    Apr 22, 2005
    Posts:
    7,825
    Referrals:
    13
    Sythe Gold:
    23
    Prove it! Trole Tier 1 Prizebox Tortoise Penis Le Monkey UWotM8? Wait, do you not have an Archer rank? Potamus

    Govind The One Musketeer
    Mudkips Highly Respected Retired Administrator

    GetBetween (get between two strings!)

    There is C++ for .NET, lol.
     
  7. Unread #4 - Nov 30, 2011 at 12:05 AM
  8. iJava
    Joined:
    Nov 21, 2011
    Posts:
    1,197
    Referrals:
    11
    Sythe Gold:
    485
    Discord Unique ID:
    220055593568829441

    iJava .Previously known as RSGoldRush
    $200 USD Donor New

    GetBetween (get between two strings!)

    Yeah but I thought that one of the main reasons people used C++ over C# or VB.Net was because of dependencies?
     
  9. Unread #5 - Nov 30, 2011 at 11:01 AM
  10. Blupig
    Joined:
    Nov 23, 2006
    Posts:
    7,145
    Referrals:
    16
    Sythe Gold:
    1,609
    Discord Unique ID:
    178533992981594112
    Valentine's Singing Competition Winner Member of the Month Winner MushyMuncher Gohan has AIDS Extreme Homosex World War 3 I'm LAAAAAAAME
    Off Topic Participant

    Blupig BEEF TOILET
    $5 USD Donor

    GetBetween (get between two strings!)

    Nope, I'll still use VB/C# over C++ any day. I hate C++. Just need it for my program at uni :p
     
< Tutorial On Boolean's | Flash game programing >

Users viewing this thread
1 guest


 
 
Adblock breaks this site