// Strip a handler command string of its quotes and parameters.
static void CleanupHandlerPath(nsString& aPath)
{
  // Example command strings passed into this routine:

  // 1) C:\Program Files\Company\some.exe -foo -bar
  // 2) C:\Program Files\Company\some.dll
  // 3) C:\Windows\some.dll,-foo -bar
  // 4) C:\Windows\some.cpl,-foo -bar

  int32_t lastCommaPos = aPath.RFindChar(',');
  if (lastCommaPos != kNotFound)
    aPath.Truncate(lastCommaPos);

  aPath.Append(' ');

  // case insensitive
  uint32_t index = aPath.Find(".exe ", true);
  if (index == kNotFound)
    index = aPath.Find(".dll ", true);
  if (index == kNotFound)
    index = aPath.Find(".cpl ", true);

  if (index != kNotFound)
    aPath.Truncate(index + 4);
  aPath.Trim(" ", true, true);
}
void nsOutlookMail::SplitString(nsString& val1, nsString& val2)
{
  // Find the last line if there is more than one!
  int32_t idx = val1.RFind("\x0D\x0A");
  int32_t  cnt = 2;
  if (idx == -1) {
    cnt = 1;
    idx = val1.RFindChar(13);
  }
  if (idx == -1)
    idx= val1.RFindChar(10);
  if (idx != -1) {
    val2 = Substring(val1, idx + cnt);
    val1.SetLength(idx);
    SanitizeValue(val1);
  }
}
void nsOutlookMail::SplitString( nsString& val1, nsString& val2)
{
    nsString  temp;

    // Find the last line if there is more than one!
    PRInt32 idx = val1.RFind( "\x0D\x0A");
    PRInt32  cnt = 2;
    if (idx == -1) {
        cnt = 1;
        idx = val1.RFindChar( 13);
    }
    if (idx == -1)
        idx= val1.RFindChar( 10);
    if (idx != -1) {
        val1.Right( val2, val1.Length() - idx - cnt);
        val1.Left( temp, idx);
        val1 = temp;
        SanitizeValue( val1);
    }
}