1
Vote

Divide by zero Error

description

I have been playing with the CleanMessage in the Sandbox, there is a divison by zero if I use the following PV1 in a message
PV1||I|SH99^^^^^^^^Southbourne Ward|||||G63452377^^^^^^^^Y02707|C245610|General Medicine|||||||||125727/1|||||||||||||||||||||||||20090628|20090701|||||^^^PAS^CP
 
private static String ReplaceEx(string original, string pattern, string replacement)
    {
        int count, position0, position1;
        count = position0 = position1 = 0;
        string upperString = original.ToUpper();
        string upperPattern = pattern.ToUpper();
        int inc = (original.Length / pattern.Length) *    
                  (replacement.Length - pattern.Length);     <<----- Line fails here as both the original and the pattern are empty strings and therefore 0 in length.
 
I'm assuming by the sample you have coded you are trying to insert a given name for an attending doctor, and then an ID????
 
I'm not a C# programmer but will attempt to go through and figure out, how your whole replace procedure is working.

comments