Автор: Юлин Дмитрий Александрович ulin@vtoroy.ru
Создайте в PB5 два текстовых файла:
f_ansi_to_ascii.srf, f_ascii_to_ansi.srf
(их содержимое ниже) и исп. Entry/Import для вставки функций в вашу .pbl
//----------------------------------
$PBExportHeader$f_ansi_to_ascii.srf
$PBExportComments$f( string_win ) -> string_dos
global type f_ansi_to_ascii from function_object
end type
forward prototypes
global function string f_ansi_to_ascii (string str1)
end prototypes
global function string f_ansi_to_ascii (string str1);int ci,i
long len_str1
string str2=""
len_str1=len(str1)
if len_str1>0 then
FOR i=1 TO len_str1
ci=asc(mid(str1,i,1))
if ci>=192 and ci<=239 then
str2=str2+char(ci - 64)
elseif ci>=240 and ci<=255 then
str2=str2+char(ci - 16)
else
str2=str2+char(ci)
end if
NEXT
return str2
else
return str2
end if
end function
//------------------------------------
$PBExportHeader$f_ascii_to_ansi.srf
$PBExportComments$f( string_dos ) -> string_win
global type f_ascii_to_ansi from function_object
end type
forward prototypes
global function string f_ascii_to_ansi (string str1)
end prototypes
global function string f_ascii_to_ansi (string str1);int ci,i
long len_str1
string str2=""
len_str1=len(str1)
if len_str1>0 then
FOR i=1 TO len_str1
ci=asc(mid(str1,i,1))
if ci>=128 and ci<=175 then
str2=str2+char(ci + 64)
elseif ci>=224 and ci<=239 then
str2=str2+char(ci + 16)
else
str2=str2+char(ci)
end if
NEXT
return str2
else
return str2
end if
end function