public static StringInfo ReplaceByPosition(this StringInfo str, string replaceBy, int offset, int count) { if (replaceBy != EMPTY) { return(str.RemoveByTextElements(offset, count).InsertByTextElements(offset, replaceBy)); } else { return(str.RemoveByTextElements(offset, count)); } }
public static StringInfo ReplaceByPosition(this StringInfo str, string replaceBy, int offset, int count) { if (!str.String.Contains(replaceBy)) { return(str); } return(str.RemoveByTextElements(offset, count).InsertByTextElements(offset, replaceBy)); }