public
OnPluginStart()
{
RegConsoleCmd(
"recase"
, ReCase);
}
public
Action:ReCase(client, args)
{
new
String
:test[
128
];
GetCmdArgString(test, sizeof(test));
PrintToChat(client,
"%s"
, ReCaseString(test));
}
stock
String
:ReCaseString(
String
:string[])
{
new
I =
0
;
while
(I < strlen(string))
{
new
Coeff =
32
;
new
Coeff2 =
1
;
new
Byte = string[I];
if
(Byte >=
128
)
{
if
(Byte >=
240
)
{
if
(strlen(string[I]) <
4
)
break
; I +=
4
;
}
else
if
(Byte >=
224
)
{
if
(strlen(string[I]) <
3
)
break
; I +=
3
;
}
else
if
(Byte >=
192
)
{
if
(strlen(string[I]) <
2
)
break
;
Byte = (Byte %
32
) *
64
; Byte += (string[I+
1
] %
64
) ;
if
( (
1040
<= Byte <=
1103
) || (Byte ==
1025
) || (Byte ==
1105
) )
{
if
((Byte ==
1025
) || (Byte ==
1105
)) { Coeff =
80
; }
if
( (
1072
<= Byte <=
1103
) || (Byte ==
1105
) ) { Coeff2 = -
1
; }
Byte = Byte+Coeff*Coeff2;
string[I] =
192
+ RoundToFloor(
float
(Byte /
64
));
string[I+
1
] =
128
+ (Byte %
64
);
}
I +=
2
;
}
else
{
break
;
}
}
else
{
if
( (
65
<= Byte <=
90
) || (
97
<= Byte <=
122
) )
{
if
(
97
<= Byte <=
122
) { Coeff2 = -
1
; }
string[I] = Byte+Coeff*Coeff2;
}
I +=
1
;
}
}
return
string;
}