中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-09 20:01
47,811 topics / 349,896 posts / today 1 new / 48,254 members
DOS批处理 & 脚本技术(批处理室) » [Resolved] How to determine whether the input is Chinese or English?
Printable Version  2,155 / 27
Floor1 tireless Posted 2008-09-19 20:03
银牌会员 Posts 1,122 Credits 2,025
RT

[ Last edited by tireless on 2008-9-21 at 04:19 PM ]
Floor2 HAT Posted 2008-09-19 20:06
版主 Posts 5,017 Credits 9,023
```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
```
Floor3 HAT Posted 2008-09-19 20:07
版主 Posts 5,017 Credits 9,023
How to separate Chinese character lines and non-Chinese character lines
http://www.cn-dos.net/forum/viewthread.php?tid=30573
Floor4 tireless Posted 2008-09-19 20:15
银牌会员 Posts 1,122 Credits 2,025
thx

[ Last edited by tireless on 2008-9-20 at 04:36 PM ]
Floor5 BC Posted 2008-09-20 08:51
中级用户 Posts 175 Credits 338
Can we use the judgment geq Z?
Floor6 tireless Posted 2008-09-20 21:09
银牌会员 Posts 1,122 Credits 2,025
Further ask this question, help out ah

Requirement: Calculate the "value" of characters
Chinese characters = 19
English (including spaces) = 10

For example, input 123 一二, then calculate the result of 4*10+2*19
Floor7 moniuming Posted 2008-09-20 22:09
银牌会员 Posts 574 Credits 1,335 From 广西
I wonder if this would work:
Floor8 tireless Posted 2008-09-20 22:21
银牌会员 Posts 1,122 Credits 2,025
Floor9 moniuming Posted 2008-09-20 22:24
银牌会员 Posts 574 Credits 1,335 From 广西
Originally posted by tireless at 2008-9-20 22:21:
It doesn't work when there are spaces

Does it also need to calculate the value of spaces???
Floor10 moniuming Posted 2008-09-20 22:34
银牌会员 Posts 574 Credits 1,335 From 广西
If you don't count the value of spaces, just remove the spaces...
Floor11 tireless Posted 2008-09-20 22:37
银牌会员 Posts 1,122 Credits 2,025
To calculate the value of a space. The value of a space is the same as that of English.
Floor12 HAT Posted 2008-09-20 23:13
版主 Posts 5,017 Credits 9,023
Can the code on floor 7 add double quotes when comparing?
Floor13 radem Posted 2008-09-20 23:36
高级用户 Posts 383 Credits 691
Originally posted by HAT at 2008-9-20 11:13 PM:
Can the code on floor 7 add double quotes during comparison?


It works!
Floor14 tireless Posted 2008-09-20 23:49
银牌会员 Posts 1,122 Credits 2,025
Originally posted by HAT at 2008-9-20 03:13 AM:
Can the code on floor 7 add double quotes when comparing?
Floor15 HAT Posted 2008-09-21 01:30
版主 Posts 5,017 Credits 9,023
Then use the idea of the 2nd floor
1 2  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023