summaryrefslogtreecommitdiff
path: root/WorldlineKeepers/Assets/ThirdParty/CSV-Parser/CSV Parser/src/DelimiterExtensions.cs
blob: a38371d6bb9c9ad957208c3e8315c3828cd82fde (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using System;
using System.ComponentModel;

namespace yutokun
{
    public static class DelimiterExtensions
    {
        public static char ToChar(this Delimiter delimiter)
        {
            // C# 7.3: Unity 2018.2 - 2020.1 Compatible
            switch (delimiter)
            {
                case Delimiter.Auto:
                    throw new InvalidEnumArgumentException("Could not return char of Delimiter.Auto.");
                case Delimiter.Comma:
                    return ',';
                case Delimiter.Tab:
                    return '\t';
                default:
                    throw new ArgumentOutOfRangeException(nameof(delimiter), delimiter, null);
            }
        }
    }
}