Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hellow
debuging the following method i got strange error in StringSplitOptions.RemoveEmptyEntries, the debugger wrote i need new (for memory)
i need your comment
this is the whole code(small size code)
        public static int TestStringSplitOptions()
        {
            string buff;
            string[] ssFeedo = new string[6];
            int day,month;
            /*
            //My input file has only 2 line and Start from next line
            MyDate.txt
            20 07
            */
            //assume MyhFile is defined correctly somewhere else
            buff = MyhFile.ReadLine();//buff="MyDate.txt"
            
            buff = MyhFile.ReadLine();//buff="20 07"
           //MessageBox.Show(buff);
// the font between quots are english space i mean {' '} in next line
ssFeedo = buff.Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries);//<--not certain about this
            day = int.Parse(ssFeedo[0]);
            month = int.Parse(ssFeedo[1]);
       }
Posted
Updated 16-Nov-12 7:06am
v5
Comments
Thomas Daniels 16-Nov-12 13:11pm    
What I'll tell you here, isn't an answer, but another thing.
First you set buff to MyhFile.ReadLine();
Then, in another line, you set buff to MyhFile.ReadLine();
But, then you the value of buff is only the second line.

The line is correct, should work, but initialization of ssFeedo is totally redundant; and the initial value will simply be discarded: String.Split creates a brand new object.

You use incorrect terminology which can compromise understanding of your post it you keep using it. What you call "font" is actually a "characters". Fonts have nothing to do with strings and string processing at all.

If you have any concerns, you need to use the debugger. Actually, you should use a debugger before asking such questions, every time.

—SA
 
Share this answer
 
v2
Comments
Thomas Daniels 16-Nov-12 13:27pm    
He used the debugger.
In the question:
the debugger wrote i need new (for memory)
Sergey Alexandrovich Kryukov 16-Nov-12 13:30pm    
In my view, not quite :-) And I don't understand this phrase. I don't thing a debugger could possibly issue such message; I think this is the OP's phrasing based on some illusionary observations -- such things happen all the time; I don't understand why would you repeat these words...
--SA
Thomas Daniels 16-Nov-12 13:32pm    
Ok.
Anyway, a 5!
Sergey Alexandrovich Kryukov 16-Nov-12 14:55pm    
Than you again.
--SA
Thomas Daniels 16-Nov-12 13:45pm    
Comment from the OP, posted as a non-answer (Solution 2):
you wrote ssFeedo is totally redundant;
you may meant the following line
string[] ssFeedo = new string[6];

could you please correct that,
if not this line let me know the exact answer
someone wrote
I don't thing a debugger could possibly issue such message

actualy i got this answer for my big program .if i posted here no one is willing to look at it
i need the exact answer please
thanks
you are right it is a character not a font ,but if this space character is written in arabic font i mean in the above input text file the character space {' '} should be in arabic too

you wrote ssFeedo is totally redundant;
you may meant the following line
string[] ssFeedo = new string[6];
should i use

string[] ssFeedo;

could you please correct that,
if not this line let me know the exact answer
someone wrote
I don't thing a debugger could possibly issue such message

actualy i got this message (may be a similar ) for my big program .if i posted here no one is willing to look at it
i need the exact answer please
thanks
 
Share this answer
 
v5
Comments
Thomas Daniels 16-Nov-12 13:45pm    
If you've a comment to a answer, click on the "Have a Question or Comment?" button.
Don't post a comment as an answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900