lab1 - сдано

This commit is contained in:
DyCTaTOR 2024-10-15 10:29:10 +04:00
parent ff464aea76
commit 86ac64ad42

View File

@ -25,10 +25,12 @@ namespace WinFormsLibrary1
listBox.SelectedIndex = value; listBox.SelectedIndex = value;
} }
} }
public ListBoxUserControl() public ListBoxUserControl()
{ {
InitializeComponent(); InitializeComponent();
} }
public void SetParams(string template, char? fromChar, char? toChar) public void SetParams(string template, char? fromChar, char? toChar)
{ {
_template = template; _template = template;
@ -49,7 +51,7 @@ namespace WinFormsLibrary1
var curObject = new T(); var curObject = new T();
string text = listBox.SelectedItem?.ToString() ?? ""; string text = listBox.SelectedItem?.ToString() ?? "";
var words = System.Text.RegularExpressions.Regex.Split(_template, $@"\{_startSymbol.Value}.*?\{_endSymbol.Value}"); var words = Regex.Split(_template, $@"\{_startSymbol.Value}.*?\{_endSymbol.Value}");
int firstWordStart = text.IndexOf(words[0], 0); int firstWordStart = text.IndexOf(words[0], 0);
if (firstWordStart == -1) if (firstWordStart == -1)