Results 1 to 15 of 15
Thread: .:
Hybrid View
-
20th August 2007 22:18 #1
.:
,
:
:Code:Ivan__Gosho_Pesho_____Misho__
, .Code:Ivan__ Gosho_ Pesho_____ Misho__
ThinkPad R61 8918-DFG
-
20th August 2007 23:11 #2
-
20th August 2007 23:54 #3
-
20th August 2007 23:14 #4
-
21st August 2007 00:23 #5
,

: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
-
26th August 2007 00:31 #6
-
21st August 2007 00:30 #7Registered User
Join Date: Aug:2006
Location:
Posts: 4,052
Move back, I know regular expressions!
-
22nd August 2007 02:15 #8Registered User
Join Date: Jul:2006
Location:
Posts: 480
regexp ...
:
P.S. -, ?! ... I!=i!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; }Last edited by K55; 22nd August 2007 at 02:21.
-
22nd August 2007 07:00 #9
, , (tm) .NET ( / ), .
Internet - it doesn't make you stupid, it just makes your stupidity more accessible to others
-
23rd August 2007 20:50 #10Registered User
Join Date: Jul:2006
Location:
Posts: 480
, _, 10 . .
-
24th August 2007 11:59 #11
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, .
-
25th August 2007 04:07 #12
, :
"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
-
27th August 2007 12:46 #13
: Regex
Iv_an__
Go_sho_
Pes_ho_____
Mish_o__
:
Iv_an
Go_sho
Pes_ho
Mish_o
ThinkPad R61 8918-DFG
-
28th August 2007 10:25 #14
, . _+$, "_" . :
newName oldName, .Code:string newName = Regex.Replace(oldName, @"_+$", "");
Internet - it doesn't make you stupid, it just makes your stupidity more accessible to others
-
28th August 2007 14:44 #15




Reply With Quote

Lenovo ThinkPad 15 IdeaPad 15
5th May 2023, 22:16 in