Удаляем пробелы в Edit.

 

 

 

 

 

 Unit1.cpp

//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
//Начало. Удалить пробелы из Edit

AnsiString str= Edit1->Text; // Объявляем переменную типа AnsiString str
for (int i = 1; i < str.Length(); i++) //Просчитываем текущее количество символов в строке
	{
	  if (str[i] == ' ') //Если находим пробелы
	  str.Delete(i--, 1); //Удаляем
	  Edit1->Text = str; //Выводим результат

	}

//Конец. Удалить пробелы из Edit
}
//---------------------------------------------------------------------------

 Unit1.h

//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:	// IDE-managed Components
	TEdit *Edit1;
	TButton *Button1;
	void __fastcall Button1Click(TObject *Sender);
private:	// User declarations
public:		// User declarations
	__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif