ex-int-05-numbers/Numbers/NumberString/NumberString.cs
github-classroom[bot] b087f272b4
Initial commit
2025-04-29 15:03:45 +00:00

66 lines
1.9 KiB
C#

using System.Collections;
namespace Numbers.NumberString;
/// <summary>
/// Represents a string consisting of digits and letters intermixed
/// </summary>
/// <inheritdoc cref="IEnumerable{T}" />
/// <inheritdoc cref="IComparable{T}" />
public sealed class NumberString : IEnumerable<int>, IComparable<NumberString>
{
// TODO
// private readonly string _text;
// private int? _numericValue;
/// <summary>
/// Creates a new instance of <see cref="NumberString" /> based on the given text.
/// As a simplification, the text is assumed to be a valid number string.
/// </summary>
/// <param name="text">A string containing digits and letters</param>
public NumberString(string text)
{
// TODO
}
/// <summary>
/// Gets the numeric value contained in the number string
/// </summary>
public int NumericValue => -1; // TODO
/// <summary>
/// Gets the digit at the given index.
/// If the index is out of range, -1 is returned.
/// </summary>
/// <param name="index">Digit index</param>
public int this[int index]
{
get
{
// TODO
return -1;
}
}
public int CompareTo(NumberString? other) => -1; // TODO
public IEnumerator<int> GetEnumerator() => null!; // TODO
IEnumerator IEnumerable.GetEnumerator() => null!; // TODO
public override bool Equals(object? obj)
{
// TODO
return false;
}
public override int GetHashCode() => -1; // TODO
public static bool operator >(NumberString a, NumberString b) => false; // TODO
public static bool operator <(NumberString a, NumberString b) => false; // TODO
public static bool operator ==(NumberString a, NumberString b) => false; // TODO
public static bool operator !=(NumberString a, NumberString b) => false; // TODO
}