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

Спасибо.
...
Рейтинг: 0 / 0
15.12.2006, 16:24
    #34203786
sashka304
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Изменение регистра строк (char и string)
на если на билдере, то есть такая ф-я
Код: 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
15.12.2006, 16:24
    #34203791
maXmo
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Изменение регистра строк (char и string)
strupr, stricmp
...
Рейтинг: 0 / 0
15.12.2006, 16:26
    #34203796
sashka304
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Изменение регистра строк (char и string)
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
15.12.2006, 16:28
    #34203811
Igor Gryb
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Изменение регистра строк (char и string)
Ну если русские буквы:
...
Рейтинг: 0 / 0
15.12.2006, 17:42
    #34204143
maXmo
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Изменение регистра строк (char и string)
русские буквы точно если?
...
Рейтинг: 0 / 0
Форумы / C++ [игнор отключен] [закрыт для гостей] / Изменение регистра строк (char и string) / 6 сообщений из 6, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


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