PDA

View Full Version : سوال: کار متد GetDataPart() چیست ؟



Direlap
یک شنبه 10 اردیبهشت 1391, 14:34 عصر
سلام

این کد رو تو پروژه چت سرور دیدم ولی ازش سردر نمیارم .

کدش این بود :

string[] txtR = GetDataPart(textRecieve);

که textRecieve هم از نوع رشته هست .

ممنون

Hossenbor
یک شنبه 10 اردیبهشت 1391, 14:42 عصر
دوسته عزیز این از توابع استاندارد مایکروسافت نیست اسکریپتش از چه نوعی بود؟

Direlap
یک شنبه 10 اردیبهشت 1391, 14:48 عصر
تو این لینک دیدم و همچنین تو پروژه نرم افزار مسنجر همین سایت هم هست این کدش .

http://social.msdn.microsoft.com/Forums/en-US/netfxnetcom/thread/790d93da-724a-4ebc-8aa4-e824e2359073

Hossenbor
یک شنبه 10 اردیبهشت 1391, 14:55 عصر
دوسته عزیز مربوط به این متد هست
string[] GetDataPart(string StringData)
{
string[] txtR = new string[10];
int Index = 0;
int LastIndex = 0;
int j = 0;
for (int i = 0; i < 10; i++)
txtR[i] = "";
while (Index != -1)
{
Index = StringData.IndexOf(Spliter, LastIndex);
if (Index != -1)
{
if ((Index + 5) == StringData.Length || ((Index + 10) < StringData.Length || StringData.Substring(Index + 5, 5) != ReverseSpliter))
{
txtR[j] += StringData.Substring(LastIndex, Index - LastIndex);
j++;
LastIndex = Index + 5;
}
else if ((Index + 10) < StringData.Length && StringData.Substring(Index + 5, 5) == ReverseSpliter)
{
txtR[j] += StringData.Substring(LastIndex, Index - LastIndex + 5);
LastIndex = Index + 10;
}
}
}
return txtR;
}