Click here to Skip to main content
15,921,716 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to write this regex? Pin
AspDotNetDev10-Jun-10 12:41
protectorAspDotNetDev10-Jun-10 12:41 
QuestionMaximum Width And Height of panel Pin
VCsamir8-Jun-10 21:42
VCsamir8-Jun-10 21:42 
AnswerRe: Maximum Width And Height of panel Pin
DaveyM698-Jun-10 22:27
professionalDaveyM698-Jun-10 22:27 
AnswerRe: Maximum Width And Height of panel Pin
Tsuda Kageyu8-Jun-10 22:39
Tsuda Kageyu8-Jun-10 22:39 
QuestionMerge menu items using the MenuStrip Pin
Eduard Keilholz8-Jun-10 21:29
Eduard Keilholz8-Jun-10 21:29 
QuestionAdvancing On Pressing Enter Pin
Roger Wright8-Jun-10 19:43
professionalRoger Wright8-Jun-10 19:43 
AnswerRe: Advancing On Pressing Enter Pin
Anshul R8-Jun-10 20:21
Anshul R8-Jun-10 20:21 
AnswerRe: Advancing On Pressing Enter Pin
Peace ON8-Jun-10 20:37
Peace ON8-Jun-10 20:37 
GeneralRe: Advancing On Pressing Enter Pin
Roger Wright8-Jun-10 20:47
professionalRoger Wright8-Jun-10 20:47 
AnswerRe: Advancing On Pressing Enter Pin
Dan Mos8-Jun-10 20:47
Dan Mos8-Jun-10 20:47 
GeneralRe: Advancing On Pressing Enter Pin
Roger Wright8-Jun-10 20:52
professionalRoger Wright8-Jun-10 20:52 
GeneralRe: Advancing On Pressing Enter Pin
Dan Mos8-Jun-10 20:55
Dan Mos8-Jun-10 20:55 
AnswerRe: Advancing On Pressing Enter Pin
Henry Minute9-Jun-10 0:19
Henry Minute9-Jun-10 0:19 
AnswerRe: Advancing On Pressing Enter Pin
Richard Andrew x649-Jun-10 4:39
professionalRichard Andrew x649-Jun-10 4:39 
Questionbinning at zero-filling data Pin
shekarchee8-Jun-10 19:41
shekarchee8-Jun-10 19:41 
AnswerRe: binning at zero-filling data Pin
EliottA9-Jun-10 2:19
EliottA9-Jun-10 2:19 
AnswerRe: binning at zero-filling data Pin
LookSharp9-Jun-10 3:40
LookSharp9-Jun-10 3:40 
For text data, look for lines that don't contain an embedded space, then append " 0":

public List<string> CleanupText(List<string> inputLines)
    {
    List<string> outputLines = new List<string>();
    foreach (string s in inputLines)
        {
        // Note: the Trim() and Replace() ensure that (a) there are no false hits and (b) no false misses, respectively
        if (s.Trim().Replace('\t', ' ').Contains(" "))
            outputLines.Add(s);
        else
            outputLines.Add(string.Concat(s, " 0"));
        }
    return outputLines;
    }


If you want to modify the collection in place, you'll have to replace the foreach() with a for() and an index into the list - since foreach() loops disallow modifying the collection they are iterating.

To do this with Excel you'll have to iterate rows (the end condition being a cell in the first column that is empty), looking for cells in the 2nd column that are blank and inserting a '0' into those blank cells. I've not done enough MSOffice interop to be able to give you a code example.
QuestionClone Windows Forms Information Pin
Illegal Operation8-Jun-10 19:30
Illegal Operation8-Jun-10 19:30 
AnswerRe: Clone Windows Forms Information Pin
Anshul R8-Jun-10 20:27
Anshul R8-Jun-10 20:27 
AnswerRe: Clone Windows Forms Information Pin
Peace ON8-Jun-10 20:44
Peace ON8-Jun-10 20:44 
QuestionWindows application create an Excel file Pin
Member 44642398-Jun-10 11:45
Member 44642398-Jun-10 11:45 
AnswerRe: Windows application create an Excel file Pin
Dan Mos8-Jun-10 11:59
Dan Mos8-Jun-10 11:59 
AnswerRe: Windows application create an Excel file Pin
Ramkithepower9-Jun-10 4:01
Ramkithepower9-Jun-10 4:01 
Questionwindows application Pin
jashimu8-Jun-10 8:36
jashimu8-Jun-10 8:36 
AnswerRe: windows application Pin
Manas Bhardwaj8-Jun-10 9:08
professionalManas Bhardwaj8-Jun-10 9:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.