powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / C++ [игнор отключен] [закрыт для гостей] / Изменение регистра строк (char и string)
6 сообщений из 6, страница 1 из 1
Изменение регистра строк (char и string)
    #34203732
Igor Gryb
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Привет всем.,
Как мне перевести строку (char или srring), например, в верхний регистр
и можно ли сравнить строки игнорируя регистр.. ?

Спасибо.
...
Рейтинг: 0 / 0
Изменение регистра строк (char и string)
    #34203786
Фотография sashka304
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
на если на билдере, то есть такая ф-я
Код: plaintext
extern PACKAGE AnsiString__fastcall UpperCase(const AnsiString S);
Description
UpperCase returns a copy of the string S, with the same text but with all 7-bit ASCII characters between 'a' and 'z' converted to uppercase. To convert 8-bit international characters, use AnsiUpperCase instead.

или так
The following code uppercases every other character in the text of an edit control when the user clicks the button.
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
void __fastcall TForm1::Button1Click(TObject *Sender)

{

  // Get string from TEdit control 

  AnsiString s = Edit1->Text;

  for (int i =  0 ; i < s.Length(); i +=  2 )

  {
    s[i] := UpCase(s[i]);
    Edit1->Text = s;
  }
}
...
Рейтинг: 0 / 0
Изменение регистра строк (char и string)
    #34203791
maXmo
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
strupr, stricmp
...
Рейтинг: 0 / 0
Изменение регистра строк (char и string)
    #34203796
Фотография sashka304
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Header File

string.h, wchar.h

Category

Memory and String Manipulation Routines

Prototype

int strcmpi(const char *s1, const char *s2);

int _wcscmpi(const wchar_t *s1, const wchar_t *s2);

Description

Compares one string to another, without case sensitivity.

strcmpi performs an unsigned comparison of s1 to s2, without case sensitivity (same as stricmp--implemented as a macro).

It returns a value (< 0, 0, or > 0) based on the result of comparing s1 (or part of it) to s2 (or part of it).

The routine strcmpi is the same as stricmp. strcmpi is implemented through a macro in string.h and translates calls from strcmpi to stricmp. Therefore, in order to use strcmpi, you must include the header file string.h for the macro to be available. This macro is provided for compatibility with other C compilers.

Return Value

If s1 is... strcmpi returns a value that is...

less than s2 < 0
the same as s2 == 0
greater than s2 > 0
...
Рейтинг: 0 / 0
Изменение регистра строк (char и string)
    #34203811
Igor Gryb
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Ну если русские буквы:
...
Рейтинг: 0 / 0
Изменение регистра строк (char и string)
    #34204143
maXmo
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
русские буквы точно если?
...
Рейтинг: 0 / 0
6 сообщений из 6, страница 1 из 1
Форумы / C++ [игнор отключен] [закрыт для гостей] / Изменение регистра строк (char и string)
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]