![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
Pchar
Вентилятор © (2004-07-28 10:56:00)Вопрос немного необычный. Просьба не ругать. Как можно преобразовать переменную pchar из нижнего регистра в верхний и наоборот , НЕ используя при этом тип string и функции с ним связанные ?
Вентилятор (2004-07-28 11:46:00) [21]
> 2Вентилятор (28.07.04 11:35) [11]
>
> > за F1 отдельное спасибо :)
>
> Мог бы и сам нажать.
Ну это я умею слава богу. Но никак не получается у меня реализовать:
var p,c:pchar;
begin
p:='dDd';
CharUpperBuff(@p,3);
messagebox(0,p,'',0);
end.
Выдает 'dDd'
Fay (2004-07-28 11:44:00) [22]2Вентилятор (28.07.04 11:34) [10]
>> обязательно выделять? а каким методом предпочтительнее?
Методом? Спросил бы для начала "каким объектом?"/ 8)
Fay (2004-07-28 11:42:00) [23]2Вентилятор (28.07.04 11:35) [11]
> за F1 отдельное спасибо :)
Мог бы и сам нажать.
Вентилятор (2004-07-28 11:35:00) [24]
> Fay © (28.07.04 11:23) [6]
за F1 отдельное спасибо :)
Вентилятор (2004-07-28 11:34:00) [25]
> Poirot © (28.07.04 11:25) [7]
обязательно выделять? а каким методом предпочтительнее?
Вентилятор (2004-07-28 11:33:00) [26]
> Anatoly Podgoretsky © (28.07.04 11:28) [8]
где ?
var p:pchar;
begin
p:='dDd';
тут?^
но ведь pэто вроде переменная? или всетаки константа?
Anatoly Podgoretsky (2004-07-28 11:28:00) [27]Чего же ты пытаешься писать в память ReadOnly, в константу.
Poirot (2004-07-28 11:25:00) [28]А ты пямять выделить не забыл случайно????... ))))
Fay (2004-07-28 11:23:00) [29]CharUpperBuff
The CharUpperBuff function converts lowercase characters in a buffer to uppercase characters. The function converts the characters in place.
DWORD CharUpperBuff(
LPTSTR lpsz, // characters
DWORD cchLength // number of characters to process
);
Parameters
lpsz
[in] Pointer to a buffer containing one or more characters to process.
cchLength
[in] Specifies the size, in TCHARs, of the buffer pointed to by lpsz. This refers to bytes for ANSI versions of the function or WCHARs for Unicode versions.
The function examines each character, and converts lowercase characters to uppercase characters. The function examines the number of characters indicated by cchLength, even if one or more characters are null characters.
Return Values
The return value is the number of TCHARs processed.
For example, if CharUpperBuff("Zenith of API Sets", 10) succeeds, the return value is 10.
Remarks
Note that CharUpperBuff always maps lowercase I to uppercase I, even when the current language is Turkish or Azeri.
Windows NT/2000/XP: To make the conversion, the function uses the language driver for the current language selected by the user at setup or by using Control Panel. If no language has been selected, the system completes the conversion by using internal default mapping. The conversion is made based on the code page associated with the process locale.
Windows 95/98/Me: The function makes the conversion based on the information associated with the user's default locale, which is the locale selected by the user at setup or by using Control Panel. The system does not have language drivers.
Windows 95/98/Me: CharUpperBuffW is supported by the Microsoft Layer for Unicode. To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me Systems.
Вентилятор (2004-07-28 11:22:00) [30]program Project1;
uses
windows,sysutils;
{$R *.res}
var p,c:pchar;
begin
p:='dDd';
messagebox(0,AnsiStrLower(p),'',0);
end.
выдает ошибку. почему?
Poirot (2004-07-28 11:21:00) [31]Покажи нам как ты ето делаешь.
Вентилятор (2004-07-28 11:05:00) [32]я про SysUtils в курсе. И про то что с pchar оно умеет работать тоже знаю. Но преобразовать переменную из более чем 8 символов не очень то получилось
Reindeer Moss Eater (2004-07-28 10:59:00) [33]Unit
Sysutils
Category
string handling routines (null-terminated)
Reindeer Moss Eater (2004-07-28 10:58:00) [34]регистр переменных в паскале не имеет значения