concatenating some str to one

  • Thread starter Thread starter oren turg
  • Start date Start date
O

oren turg

Guest
hi

when i try to concatenating some str to one

the order is change

for example

str1 =number

str2 = hebrew

str3= number

the str3 concatenating to str1 and not to str2 i guess (if i concatenating with "," is should be ok but i

want fixed length

some explain:

i loop via list dictionary to get length and tag <> (from xml)

after i loop via xml (treat xml like txt)

and get the value between TAG compare list exist and txt/xml exist if match i

get the value between tag and concatenating till end of list dictionary

the problem:::::

the concatenating not by order because the hebrew is RTL i guess

any suggestions?

thanks

for (int index = 0; index < dict.Count; index++)
{
var item = dict.ElementAt(index);
var itemKey = item.Key;
var itemValue = item.Value;

// int x = Int32.Parse(itemKey);
StringBuilder builder = new StringBuilder(itemValue);
builder.Replace("<", "</");
int lengthh = builder.Length;


StringBuilder builderWO = new StringBuilder(itemValue);
builderWO.Replace(">", "/>");


foreach (string line in lines)
{

int theFirstLen = line.Trim().IndexOf(itemValue);
int theLastLen = line.Trim().IndexOf(builder.ToString());
int theLastLenWO_OPEN = line.Trim().IndexOf(builderWO.ToString());

if (theFirstLen >= 0 && theLastLen > 0 || theLastLenWO_OPEN >=0 )


{

if (theLastLenWO_OPEN >= 0) //mean that we need to put spaces only
{
SR_LEFT = SR_LEFT + "{" + i + ",-" + itemKey.Substring(0, itemKey.IndexOf(".")) + "}";
Console.WriteLine(itemKey.Length - itemKey.IndexOf("."));

SR_RIGHT = SR_RIGHT + new string(' ', Int32.Parse(itemKey.Substring(0, itemKey.IndexOf("."))));

i += 1;

break;
}

else
{
// Console.WriteLine(line.Trim().Substring(theFirstLen + lengthh, theLastLen - theFirstLen - lengthh));
SR_LEFT = SR_LEFT + "{" + i + ",-" + itemKey.Substring(0, itemKey.IndexOf(".")) + "}";
SR_RIGHT = SR_RIGHT + line.Trim().Substring(theFirstLen + lengthh, theLastLen - theFirstLen - lengthh);

i += 1;

break;


}
}
}
}
using (StreamWriter sw = new StreamWriter("C:\\TST.TEXT", false))
{

sw.WriteLine(SR_LEFT, SR_RIGHT);

}
}









when i try to concatenating some str to one

the order is change

for example

str1 =number

str2 = hebrew

str3= number

the str3 concatenating to str1 and not to str2 i guess (if i concatenating with "," is should be ok but i

want fixed length

some explain:

i loop via list dictionary to get length and tag <> (from xml)

after i loop via xml (treat xml like txt)

and get the value between TAG compare list exist and txt/xml exist if match i

get the value between tag and concatenating till end of list dictionary

the problem:::::

the concatenating not by order because the hebrew is RTL i guess

any suggestions?

thanks

for (int index = 0; index < dict.Count; index++)
{
var item = dict.ElementAt(index);
var itemKey = item.Key;
var itemValue = item.Value;

// int x = Int32.Parse(itemKey);
StringBuilder builder = new StringBuilder(itemValue);
builder.Replace("<", "</");
int lengthh = builder.Length;


StringBuilder builderWO = new StringBuilder(itemValue);
builderWO.Replace(">", "/>");


foreach (string line in lines)
{

int theFirstLen = line.Trim().IndexOf(itemValue);
int theLastLen = line.Trim().IndexOf(builder.ToString());
int theLastLenWO_OPEN = line.Trim().IndexOf(builderWO.ToString());

if (theFirstLen >= 0 && theLastLen > 0 || theLastLenWO_OPEN >=0 )


{

if (theLastLenWO_OPEN >= 0) //mean that we need to put spaces only
{
SR_LEFT = SR_LEFT + "{" + i + ",-" + itemKey.Substring(0, itemKey.IndexOf(".")) + "}";
Console.WriteLine(itemKey.Length - itemKey.IndexOf("."));

SR_RIGHT = SR_RIGHT + new string(' ', Int32.Parse(itemKey.Substring(0, itemKey.IndexOf("."))));

i += 1;

break;
}

else
{
// Console.WriteLine(line.Trim().Substring(theFirstLen + lengthh, theLastLen - theFirstLen - lengthh));
SR_LEFT = SR_LEFT + "{" + i + ",-" + itemKey.Substring(0, itemKey.IndexOf(".")) + "}";
SR_RIGHT = SR_RIGHT + line.Trim().Substring(theFirstLen + lengthh, theLastLen - theFirstLen - lengthh);

i += 1;

break;


}
}
}
}
using (StreamWriter sw = new StreamWriter("C:\\TST.TEXT", false))
{

sw.WriteLine(SR_LEFT, SR_RIGHT);

}
}








oren t

Continue reading...
 
Back
Top