Skip to content

Commit 01b81b6

Browse files
committed
Replace range operators with Substring method for compatibility
1 parent e0dd510 commit 01b81b6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

SQL.Formatter/Core/Tokenizer.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public JSLikeList<Token> Tokenize(string input)
9090
if (!string.IsNullOrEmpty(input))
9191
{
9292
token = GetNextToken(input, token);
93-
input = input[token.Value.Length..];
93+
input = input.Substring(token.Value.Length);
9494
tokens.Add(token.WithWhitespaceBefore(whitespaceBefore));
9595
}
9696
}
@@ -101,7 +101,7 @@ public JSLikeList<Token> Tokenize(string input)
101101
private static string[] FindBeforeWhitespace(string input)
102102
{
103103
var index = input.TakeWhile(char.IsWhiteSpace).Count();
104-
return new[] { input[..index], input[index..] };
104+
return new[] { input.Substring(0, index), input.Substring(index) };
105105
}
106106

107107
private Token GetNextToken(string input, Token previousToken)
@@ -161,7 +161,7 @@ private Token GetPlaceholderToken(string input)
161161
private Token GetIdentNamedPlaceholderToken(string input)
162162
{
163163
return GetPlaceholderTokenWithKey(
164-
input, _indentNamedPlaceholderPattern, v => v[1..]);
164+
input, _indentNamedPlaceholderPattern, v => v.Substring(1));
165165
}
166166

167167
private Token GetStringNamedPlaceholderToken(string input)
@@ -170,13 +170,13 @@ private Token GetStringNamedPlaceholderToken(string input)
170170
input,
171171
_stringNamedPlaceholderPattern,
172172
v => GetEscapedPlaceholderKey(
173-
v[2..^1], v[^1..]));
173+
v.Substring(2, v.Length - 3), v.Substring(v.Length - 1)));
174174
}
175175

176176
private Token GetIndexedPlaceholderToken(string input)
177177
{
178178
return GetPlaceholderTokenWithKey(
179-
input, _indexedPlaceholderPattern, v => v[1..]);
179+
input, _indexedPlaceholderPattern, v => v.Substring(1));
180180
}
181181

182182
private static Token GetPlaceholderTokenWithKey(string input, Regex regex, Func<string, string> parseKey)

0 commit comments

Comments
 (0)