Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit Unit1;
- interface
- uses
- Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
- Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
- type
- TForm1 = class(TForm)
- ListBox1: TListBox;
- ListBox2: TListBox;
- procedure FormShow(Sender: TObject);
- private
- procedure ExtrairMedidas;
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form1: TForm1;
- implementation
- uses
- System.RegularExpressions;
- {$R *.dfm}
- procedure TForm1.FormShow(Sender: TObject);
- begin
- ExtrairMedidas;
- end;
- procedure TForm1.ExtrairMedidas;
- var
- I: Integer;
- R: TRegEx;
- M: TMatch;
- begin
- for I := 0 to Pred(ListBox1.Count) do begin
- R := TRegEx.Create('\d+\s?[X,x]\s?\d+',[roIgnoreCase]);
- M := R.Match(ListBox1.Items[I]);
- if M.Success then
- ListBox2.Items.Add(M.Value);
- end;
- end;
- end.
- //=====================================================================================
- object Form1: TForm1
- Left = 0
- Top = 0
- Caption = 'Form1'
- ClientHeight = 163
- ClientWidth = 503
- Color = clBtnFace
- Font.Charset = DEFAULT_CHARSET
- Font.Color = clWindowText
- Font.Height = -11
- Font.Name = 'Tahoma'
- Font.Style = []
- OldCreateOrder = False
- OnShow = FormShow
- PixelsPerInch = 96
- TextHeight = 13
- object ListBox1: TListBox
- Left = 8
- Top = 32
- Width = 249
- Height = 97
- ItemHeight = 13
- Items.Strings = (
- 'KIT ENGENHARIA 1200 X 1200 8 MM'
- 'KIT BOX CANTO ALUMASA 1000X1900'
- 'KIT ENG WD J2 250 X 120'
- 'KIT PORTA 1200 X 2400 8MM 2 FOLHAS'
- 'KIT RETRATIL 2F 1000X2400')
- TabOrder = 0
- end
- object ListBox2: TListBox
- Left = 280
- Top = 32
- Width = 209
- Height = 97
- ItemHeight = 13
- TabOrder = 1
- end
- end
Add Comment
Please, Sign In to add comment