မင်္ဂလာပါ!

လှိုက်လှဲစွာကြိုဆိုပါသည်။ ယခု ပထမဆုံးအကြိမ် ရောက်ဖူးခြင်းဖြစ်ပါသလား? ဝင်ရောက် ဆွေးနွေး မေးမြန်းလိုပါလျှင် အောက်တွင်ဖော်ပြထားသော button များမှတဆင့် ဝင်ရောက် ဆွေးနွေးနိုင်သကဲ့သို့ အဖွဲ့ဝင်အသစ်အနေဖြင့်လည်း လျှောက်ထားနိုင်ပါတယ်။

MYSTERY ZILLION တွင် English သို့မဟုတ် Unicode ဖြင့်သာ အသုံးပြုခွင့်ရှိသည်။ ဇော်ဂျီ ၊ ဧရာ စသည်တို့ကို အသုံးပြုခွင့် မရှိ။ Unicode fonts များမှာ Mon3,Yunghkio, Myanamr3 စသည်များ အသုံးပြုနိုင်သည်။ Unicode Guide ကို ဒီမှာ Download ချပါ။ Zawgyi to Unicode Converter
Don't share ebook or software if nobody request. You can find free book websites on here. We are welcome for discussion or asking question instead.

how can i split or is there any other Method.?

how can i split or is there any other Method.?
eg.
string str="A+B-DE";
I want to get array like that
string[] list=new string{"A","+","B","-","D","
","E"};

မှတ်ချက်များ

  • Registered Users
    string strSample = "ABC+DEF=GHI";
    char[] result = strSample.ToCharArray();
    
  • Registered Users

    Use foreach with char datatype

                   string str = "A+B-DE";                             
                    string[] strArray = new string[7];
                    int count = 0;
    
                    foreach(char c in str )
                    {
    
                        strArray[count] = Convert.ToString(c);
                        if(count == 5)
                        {
                            strArray[count] = ""; // for space character.
                            strArray[count+1] = Convert.ToString(c);
    
                        }
    
                        count = count + 1;
                    }
    
                    string[] Result = strArray;
    
  • Registered Users

    Thank You Bro.
    @Milkyway
    But They answered to me
    http://stackoverflow.com/questions/38585277/how-can-i-split-or-is-there-any-other-method.
    Atcually I want to do this
    string str="SR+EP-OREP";
    I want to get array like that
    string[] list=new string{"SR","+","EP","-","OR","
    ","EP"};

  • edited July 2016 Registered Users

    It can be done like below. But is this really necessary? How you get those data?

    string sourceData = "SR+EP-OREP";
    int dataLength = 2; // define max string array item length
    List Result = new List(); // use List as it is easier to manage
    char[] splitters = new char[] { '+', '-' }; // define splitters
    
    foreach (char c in sourceData) //iterate through the source data
    {
        if (Result.Count == 0) // if there is no data, add value into array
        {
            Result.Add(c.ToString());
        }
        else
        {
            // get data from last index for comparison
            string lastData = Result[Result.Count - 1];
            if (!splitters.Contains(c) && !splitters.Contains(lastData[0]))
            {
                // if last index is already full, add emptry string into array
                if (lastData.Length == dataLength)
                {
                    Result.Add("");
                    Result.Add(c.ToString());
                }
                // if still got space in last index, append to it
                else if (lastData.Length < dataLength)
                {
                    Result[Result.Count - 1] += c.ToString();
                }
            }
            else
            {
                // if data is part of splitter, add into new index
                Result.Add(c.ToString());
            }
        }
    }
    string[] final = Result.ToArray();
    
Sign In or Register to comment.