CopyCodeThe Code is as follows: // The full-width space is 12288, and the half-width space is 32.
/// The relationship between the half-width (33-126) of other characters and the full-width (65281-65374) is as follows: the difference is 65248.
// Halfwidth conversion to fullwidth Function
Function todbc (txtstring)
{
VaR TMP = "";
For (VAR I = 0; I <txtstring. length; I ++)
{
If (txtstring. charcodeat (I) = 32)
{
TMP = TMP + String. fromcharcode (12288 );
}
If (txtstring. charcodeat (I) <127)
{
TMP = TMP + String. fromcharcode (txtstring. charcodeat (I) + 65248 );
}
}
Return TMP;
}
// Returns the halfwidth function.
Function tocdb (STR)
{
VaR TMP = "";
For (VAR I = 0; I <Str. length; I ++)
{
If (Str. charcodeat (I)> 65248 & Str. charcodeat (I) <65375)
{
TMP + = string. fromcharcode (Str. character (I)-65248 );
}
Else
{
TMP + = string. fromcharcode (Str. charcodeat (I ));
}
}
Return TMP
}