53 lines
1.1 KiB
C#
53 lines
1.1 KiB
C#
using System.Collections;
|
|
|
|
namespace Numbers.NumberString;
|
|
|
|
/// <summary>
|
|
/// Allows to enumerate only the digits in a string
|
|
/// </summary>
|
|
/// <inheritdoc cref="IEnumerator{T}"/>
|
|
public sealed class DigitEnumerator : IEnumerator<int>
|
|
{
|
|
// TODO
|
|
// private readonly string _text;
|
|
// private int _index;
|
|
|
|
/// <summary>
|
|
/// Creates a new instance of <see cref="DigitEnumerator"/> based on the given text.
|
|
/// This will be called within <see cref="NumberString.GetEnumerator"/>.
|
|
/// </summary>
|
|
/// <param name="text">The text to iterate over (containing both letters and digits)</param>
|
|
public DigitEnumerator(string text)
|
|
{
|
|
// TODO
|
|
}
|
|
|
|
public bool MoveNext()
|
|
{
|
|
// TODO
|
|
return false;
|
|
}
|
|
|
|
public void Reset()
|
|
{
|
|
// TODO
|
|
}
|
|
|
|
public int Current
|
|
{
|
|
get
|
|
{
|
|
// TODO
|
|
return -1;
|
|
|
|
//static int GetDigit(char c) => c - '0';
|
|
}
|
|
}
|
|
|
|
object IEnumerator.Current => null!; // TODO
|
|
|
|
public void Dispose()
|
|
{
|
|
// TODO?
|
|
}
|
|
}
|