Results 1 to 15 of 15

Thread: .:

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Protoss endeffect's Avatar
    Join Date: Apr:2005
    Location: Sofia
    Posts: 264

    Wink .:

    ,
    :
    Code:
    Ivan__Gosho_Pesho_____Misho__
    :
    Code:
    Ivan__
    Gosho_
    Pesho_____
    Misho__
    , .
    ThinkPad R61 8918-DFG

  2. #2
    Get a Mac moridinbg's Avatar
    Join Date: Dec:2004
    Location: 0x00000000
    Posts: 4,211
    string.split(char[])
    , string[] .

  3. #3
    Protoss endeffect's Avatar
    Join Date: Apr:2005
    Location: Sofia
    Posts: 264
    Quote Originally Posted by moridinbg View Post
    string.split(char[])
    , string[] .
    split . , .
    :
    ThinkPad R61 8918-DFG

  4. #4
    Registered User vegasis's Avatar
    Join Date: Jun:2005
    Location:
    Posts: 1,156

  5. #5
    philosophus duratea icaci's Avatar
    Join Date: Oct:2006
    Location: Aachen
    Posts: 2,698
    ,
    Code:
    using System;
    using System.Text.RegularExpressions;
    
    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                Regex r = new Regex(@"[^_]+_+");
                MatchCollection mc = r.Matches("Ivan__Gosho_Pesho_____Misho__");
                for (int i = 0; i < mc.Count; i++)
                {
                    Console.WriteLine("{0}: {1}", i, mc[i].Value);
                }
            }
        }
    }
    :
    Code:
    0: Ivan__
    1: Gosho_
    2: Pesho_____
    3: Misho__
    Internet - it doesn't make you stupid, it just makes your stupidity more accessible to others

  6. #6
    Protoss endeffect's Avatar
    Join Date: Apr:2005
    Location: Sofia
    Posts: 264
    Quote Originally Posted by icaci View Post
    ,
    Code:
    using System;
    using System.Text.RegularExpressions;
    
    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                Regex r = new Regex(@"[^_]+_+");
                MatchCollection mc = r.Matches("Ivan__Gosho_Pesho_____Misho__");
                for (int i = 0; i < mc.Count; i++)
                {
                    Console.WriteLine("{0}: {1}", i, mc[i].Value);
                }
            }
        }
    }
    :
    Code:
    0: Ivan__
    1: Gosho_
    2: Pesho_____
    3: Misho__
    . @icaci.
    ThinkPad R61 8918-DFG

  7. #7
    Registered User
    Join Date: Aug:2006
    Location:
    Posts: 4,052
    Move back, I know regular expressions!

  8. #8
    Registered User
    Join Date: Jul:2006
    Location:
    Posts: 480
    regexp ...
    :

    Code:
    #include <stdio.h>
    
    #define MAXN 128
    
    char S[]="Ivan__Gosho_Pesho_____Misho__";
    char D[MAXN];
    
    int TOKEN(char* S,char* D)
    {
        static H=0;
        int I=H,T=0;
        while(S[I]){
            switch(T){
            case 0:if(S[I]=='_')T=1;break;
            case 1:if(S[I]!='_')goto L1;}
            *D++=S[I++];}
    L1: *D=0;H=I;
        return S[I];
    }
    
    int main()
    {
        int R;
        do{ R=TOKEN(S,D);
            puts(D);}
        while(R);
        return 0;
    }
    P.S. -, ?! ... I!=i!
    Last edited by K55; 22nd August 2007 at 02:21.

  9. #9
    philosophus duratea icaci's Avatar
    Join Date: Oct:2006
    Location: Aachen
    Posts: 2,698
    , , (tm) .NET ( / ), .
    Internet - it doesn't make you stupid, it just makes your stupidity more accessible to others

  10. #10
    Registered User
    Join Date: Jul:2006
    Location:
    Posts: 480
    , _, 10 . .

  11. #11
    Registered User leechaa's Avatar
    Join Date: Aug:2007
    Location:
    Posts: 27
    string shit = "Ivan__Gosho_Pesho_____Misho__";
    string[] shit2 = shit.Split("_".ToCharArray()[0]);
    string s = "";
    for (int i = 0; i < shit2.Length; i ++)
    {
    if(shit2[i].ToString() != "")
    {
    if (s.Length > 0 && s[s.Length - 1].ToString() != "_")
    s += "_";
    s += shit2[i];
    }
    else if (s[s.Length - 1].ToString() != "_")
    s += "_";
    }
    if(s.EndsWith("_"))
    s = s.Remove(s.Length - 1, 1);
    string[] finalShit = s.Split("_".ToCharArray()[0]);

    finalShit:
    0: Ivan
    1: Gosho
    2: Pesho
    3: Misho

    ! ""!! :P
    , .

  12. #12
    philosophus duratea icaci's Avatar
    Join Date: Oct:2006
    Location: Aachen
    Posts: 2,698
    , :
    "Ivan__Gosho_Pesho_____Misho__".Split(ne w char[] {'_'}, StringSplitOptions.RemoveEmptyEntries);
    Internet - it doesn't make you stupid, it just makes your stupidity more accessible to others

  13. #13
    Protoss endeffect's Avatar
    Join Date: Apr:2005
    Location: Sofia
    Posts: 264
    : Regex
    Iv_an__
    Go_sho_
    Pes_ho_____
    Mish_o__
    :
    Iv_an
    Go_sho
    Pes_ho
    Mish_o

    ThinkPad R61 8918-DFG

  14. #14
    philosophus duratea icaci's Avatar
    Join Date: Oct:2006
    Location: Aachen
    Posts: 2,698
    , . _+$, "_" . :
    Code:
    string newName = Regex.Replace(oldName, @"_+$", "");
    newName oldName, .
    Internet - it doesn't make you stupid, it just makes your stupidity more accessible to others

  15. #15
    Protoss endeffect's Avatar
    Join Date: Apr:2005
    Location: Sofia
    Posts: 264
    .. . .
    ThinkPad R61 8918-DFG

Posting Permissions

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

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |