Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
27 lines (23 sloc) 771 Bytes
using microObjectPizzaShop.Library.Numeric;
using MicroObjectPizzaShop.Library.Texts;
namespace microObjectPizzaShop.Library.Texts {
public class InsertText : IText
{
private const int NotFound = -1;
private readonly IText _source;
private readonly IInteger _index;
private readonly IText _target;
public InsertText(IText source, IInteger index, IText target)
{
_source = source;
_index = index;
_target = target;
}
public string String()
{
int lastIndexOf = _index.Value();
if (lastIndexOf == NotFound) return _source.String();
return _source.String().Insert(_index.Value(), _target.String());
}
}
}
You can’t perform that action at this time.