Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!
Credits 9,023 Posts 5,017 Joined 2007-05-31 19:39 19-year member UID 89899 Gender Male
Status Offline
```batch
@echo off
set/p input=Input:
set str=%input%
:loop
set str=%str:~1%
set/a n+=1
if not "%str%" == "" goto loop
for /f "skip=1 delims=:" %%i in ('^(echo "%input%"^&echo.^)^|findstr /o ".*"') do set/a l=%%i-5
if %n% == %l% (
echo The string %input% does not contain double-byte characters
) else (
echo The string %input% contains double-byte characters
)
pause
```
Recent Ratings for This Post
( 1 in total)Click for details
Credits 1,335 Posts 574 Joined 2007-11-27 12:50 18-year member UID 103929 Gender Male From 广西
Status Offline
I wonder if this would work:
@echo off
setlocal enabledelayedexpansion
:bgn
set "n="
set /p str=Please enter:
:agn
set "var=%str:~,1%"
if %var% gtr Z (set /a n+=19) else (set /a n+=10)
if not "%str:~1%"=="" (set "str=%str:~1%"&goto :agn)
echo %n%
goto :bgn
Credits 1,335 Posts 574 Joined 2007-11-27 12:50 18-year member UID 103929 Gender Male From 广西
Status Offline
If you don't count the value of spaces, just remove the spaces...
@echo off
setlocal enabledelayedexpansion
:bgn
set "n="
set /p str=Please enter:
set "str=%str: =%"
set "str=%str: =%"
:agn
set "var=%str:~,1%"
if %var% gtr Z (set /a n+=19) else (set /a n+=10)
if not "%str:~1%"=="" (set "str=%str:~1%"&goto :agn)
echo %n%
goto :bgn
Credits 9,023 Posts 5,017 Joined 2007-05-31 19:39 19-year member UID 89899 Gender Male
Status Offline
Can the code on floor 7 add double quotes when comparing?
@echo off
setlocal enabledelayedexpansion
:bgn
set "n="
set /p str=Please enter:
:agn
set "var=%str:~,1%"
if "%var%" gtr "Z" (set /a n+=19) else (set /a n+=10)
if not "%str:~1%"=="" (set "str=%str:~1%"&goto :agn)
echo %n%
goto :bgn
Credits 2,025 Posts 1,122 Joined 2007-09-05 20:15 18-year member UID 96653 Gender Male
Status Offline
Originally posted by HAT at 2008-9-20 03:13 AM:
Can the code on floor 7 add double quotes when comparing?
@echo off
setlocal enabledelayedexpansion
:bgn
set "n="
set /p str=Please enter:
:agn
set "var=%str:~,1%"
if & ...
Well, the initial test is okay. But when I entered Beds before a bright moon light, I suspect it's frost on the ground. Lifting my head to watch the bright moon, bowing my head to think of home., the calculation result was wrong.
There are a total of 24 characters, and the result should be: 24*19=456
But the calculation result here is 420
Chinese punctuation should be counted as Chinese, right
Credits 9,023 Posts 5,017 Joined 2007-05-31 19:39 19-year member UID 89899 Gender Male
Status Offline
Then use the idea of the 2nd floor
@echo off
setlocal enabledelayedexpansion
set /p "str=Please enter:"
set sum=0
:loop
set "char=%str:~0,1%"
for /f "skip=1 delims=:" %%a in ('^(echo."%char%"^&echo.^)^|findstr /o ".*"') do set /a len=%%a-5
if %len% equ 1 (
set /a sum+=10
) else if %len% equ 2 (
set /a sum+=19
)
set "str=%str:~1%"
if "%str%" neq "" (
goto :loop
)
:show
echo.%sum%