Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions docs/CSharpSyntaxCheckList.md
Original file line number Diff line number Diff line change
Expand Up @@ -734,9 +734,11 @@ Note: These methods are supported for both bool and bool? types unless otherwise
8. **String Manipulation:**
- [x] `string.ToUpper()`: Converts the string to uppercase.
- [x] `string.ToLower()`: Converts the string to lowercase.
- [x] `string.Trim()`: Removes leading and trailing whitespace.
- [x] `string.Trim()`: Removes leading and trailing whitespace (supports `char` or single-element constant `char[]`).
- [x] `string.TrimStart()`: Removes leading whitespace (supports `char` or single-element constant `char[]`).
- [x] `string.TrimEnd()`: Removes trailing whitespace (supports `char` or single-element constant `char[]`).
9. **String Splitting:**
- [x] `string.Split(delimiters)`: Splits a string into an array of substrings based on specified delimiters.
- [x] `string.Split(...)`: Supported for `char`/`string` separators and single-element `char[]`/`string[]` separators. `StringSplitOptions` must be `None` or `RemoveEmptyEntries`, and `count` must remain at the default value.
10. **String Replacement:**
- [x] `string.Replace(oldValue, newValue)`: Replaces all occurrences of `oldValue` with `newValue`.
11. **String Empty or Null Check:**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,10 +391,45 @@ private static void RegisterStringHandlers()
RegisterHandler((string s) => s.ToString(), HandleStringToString);

RegisterHandler((string? s) => string.IsNullOrEmpty(s), HandleStringIsNullOrEmpty);
RegisterHandler((string? s) => string.IsNullOrWhiteSpace(s), HandleStringIsNullOrWhiteSpace);
RegisterHandler((string s, int startIndex, int length) => s.Substring(startIndex, length), HandleStringSubstring);
RegisterHandler((string s, string value) => s.Contains(value), HandleStringContains);
RegisterHandler((string s, string value) => s.StartsWith(value), HandleStringStartsWith);
RegisterHandler((string s, string value) => s.EndsWith(value), HandleStringEndsWith);
RegisterHandler((string s, string value) => s.IndexOf(value), HandleStringIndexOf);
RegisterHandler((string s, string value) => s.LastIndexOf(value), HandleStringLastIndexOf);
RegisterHandler((string strA, string strB) => string.Compare(strA, strB), HandleStringCompare);
RegisterHandler((string s, char separator) => s.Split(separator, StringSplitOptions.None), HandleStringSplit);
RegisterHandler<string, char, StringSplitOptions, string[]>((s, separator, options) => s.Split(separator, options), HandleStringSplit);
SystemCallHandlers["string.Split(char, int, System.StringSplitOptions)"] = HandleStringSplit;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not in favor about use .ToString result because it's easy to be change in a next version, but it works

SystemCallHandlers["string.Split(char, System.StringSplitOptions)"] = HandleStringSplit;
SystemCallHandlers["string.Split(char[], System.StringSplitOptions)"] = HandleStringSplit;
SystemCallHandlers["string.Split(char[], int, System.StringSplitOptions)"] = HandleStringSplit;
SystemCallHandlers["string.Split(char[])"] = HandleStringSplit;
SystemCallHandlers["string.Split(char[], int)"] = HandleStringSplit;
SystemCallHandlers["string.Split(char[]?, System.StringSplitOptions)"] = HandleStringSplit;
SystemCallHandlers["string.Split(char[]?, int, System.StringSplitOptions)"] = HandleStringSplit;
SystemCallHandlers["string.Split(char[]?)"] = HandleStringSplit;
SystemCallHandlers["string.Split(char[]?, int)"] = HandleStringSplit;
RegisterHandler<string, string?, string[]>((s, separator) => s.Split(separator, StringSplitOptions.None), HandleStringSplit);
RegisterHandler<string, string?, StringSplitOptions, string[]>((s, separator, options) => s.Split(separator, options), HandleStringSplit);
SystemCallHandlers["string.Split(string?, int, System.StringSplitOptions)"] = HandleStringSplit;
SystemCallHandlers["string.Split(string?[], System.StringSplitOptions)"] = HandleStringSplit;
SystemCallHandlers["string.Split(string?[], int, System.StringSplitOptions)"] = HandleStringSplit;
SystemCallHandlers["string.Split(string?[])"] = HandleStringSplit;
SystemCallHandlers["string.Split(string?[], int)"] = HandleStringSplit;
SystemCallHandlers["string.Split(string[], System.StringSplitOptions)"] = HandleStringSplit;
SystemCallHandlers["string.Split(string[], int, System.StringSplitOptions)"] = HandleStringSplit;
SystemCallHandlers["string.Split(string[])"] = HandleStringSplit;
SystemCallHandlers["string.Split(string[], int)"] = HandleStringSplit;
SystemCallHandlers["string.Split(string[]?, System.StringSplitOptions)"] = HandleStringSplit;
SystemCallHandlers["string.Split(string[]?, int, System.StringSplitOptions)"] = HandleStringSplit;
SystemCallHandlers["string.Split(string[]?)"] = HandleStringSplit;
SystemCallHandlers["string.Split(string[]?, int)"] = HandleStringSplit;
SystemCallHandlers["string.Split(string?[]?, System.StringSplitOptions)"] = HandleStringSplit;
SystemCallHandlers["string.Split(string?[]?, int, System.StringSplitOptions)"] = HandleStringSplit;
SystemCallHandlers["string.Split(string?[]?)"] = HandleStringSplit;
SystemCallHandlers["string.Split(string?[]?, int)"] = HandleStringSplit;
RegisterHandler((string s, int index) => s[index], HandleStringPickItem);
RegisterHandler((string s, int startIndex) => s.Substring(startIndex), HandleStringSubStringToEnd);
RegisterHandler((string? s1, string? s2) => string.Concat(s1, s2), HandleStringConcat);
Expand All @@ -403,7 +438,29 @@ private static void RegisterStringHandlers()
RegisterHandler((string s) => s.ToUpper(), HandleStringToUpper);
RegisterHandler((string s) => s.Trim(), HandleStringTrim);
RegisterHandler((string s, char trimChar) => s.Trim(trimChar), HandleStringTrimChar);
RegisterHandler<string, char[], string>((s, trimChars) => s.Trim(trimChars), HandleStringTrimCharArray);
SystemCallHandlers["string.Trim(char[])"] = HandleStringTrimCharArray;
SystemCallHandlers["string.Trim(char[]?)"] = HandleStringTrimCharArray;
SystemCallHandlers["string.Trim(params char[])"] = HandleStringTrimCharArray;
SystemCallHandlers["string.Trim(params char[]?)"] = HandleStringTrimCharArray;
RegisterHandler((string s) => s.TrimStart(), HandleStringTrimStart);
RegisterHandler((string s, char trimChar) => s.TrimStart(trimChar), HandleStringTrimStartChar);
RegisterHandler<string, char[], string>((s, trimChars) => s.TrimStart(trimChars), HandleStringTrimStartCharArray);
SystemCallHandlers["string.TrimStart(char[])"] = HandleStringTrimStartCharArray;
SystemCallHandlers["string.TrimStart(char[]?)"] = HandleStringTrimStartCharArray;
SystemCallHandlers["string.TrimStart(params char[])"] = HandleStringTrimStartCharArray;
SystemCallHandlers["string.TrimStart(params char[]?)"] = HandleStringTrimStartCharArray;
RegisterHandler((string s) => s.TrimEnd(), HandleStringTrimEnd);
RegisterHandler((string s, char trimChar) => s.TrimEnd(trimChar), HandleStringTrimEndChar);
RegisterHandler<string, char[], string>((s, trimChars) => s.TrimEnd(trimChars), HandleStringTrimEndCharArray);
SystemCallHandlers["string.TrimEnd(char[])"] = HandleStringTrimEndCharArray;
SystemCallHandlers["string.TrimEnd(char[]?)"] = HandleStringTrimEndCharArray;
SystemCallHandlers["string.TrimEnd(params char[])"] = HandleStringTrimEndCharArray;
SystemCallHandlers["string.TrimEnd(params char[]?)"] = HandleStringTrimEndCharArray;
RegisterHandler((string s, string oldValue, string newValue) => s.Replace(oldValue, newValue), HandleStringReplace);
RegisterHandler((string s, int startIndex) => s.Remove(startIndex), HandleStringRemove);
RegisterHandler((string s, int startIndex, int count) => s.Remove(startIndex, count), HandleStringRemove);
RegisterHandler((string s, int startIndex, string value) => s.Insert(startIndex, value), HandleStringInsert);
RegisterHandler((string s) => s.Length, HandleStringLength);
}

Expand Down
Loading
Loading