mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-25 04:33:04 +01:00
Merge pull request #5138 from ivandrofly/continuation-utilities
fix zero length string replace
This commit is contained in:
commit
90a8ec740b
@ -670,7 +670,7 @@ namespace Nikse.SubtitleEdit.Core.Common
|
|||||||
}
|
}
|
||||||
newFirstWord = newFirstWord.Trim();
|
newFirstWord = newFirstWord.Trim();
|
||||||
|
|
||||||
string result;
|
string result = null;
|
||||||
|
|
||||||
// If we can find it...
|
// If we can find it...
|
||||||
if (originalText.IndexOf(firstWord, StringComparison.Ordinal) >= 0)
|
if (originalText.IndexOf(firstWord, StringComparison.Ordinal) >= 0)
|
||||||
@ -678,7 +678,7 @@ namespace Nikse.SubtitleEdit.Core.Common
|
|||||||
// Replace it
|
// Replace it
|
||||||
result = ReplaceFirstOccurrence(originalText, firstWord, newFirstWord);
|
result = ReplaceFirstOccurrence(originalText, firstWord, newFirstWord);
|
||||||
}
|
}
|
||||||
else
|
else if (newFirstWord.Length > 0)
|
||||||
{
|
{
|
||||||
// Just remove whatever prefix we need to remove
|
// Just remove whatever prefix we need to remove
|
||||||
var prefix = firstWord.Replace(newFirstWord, "");
|
var prefix = firstWord.Replace(newFirstWord, "");
|
||||||
|
Loading…
Reference in New Issue
Block a user