中国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-09-29 19:00
47,813 topics / 349,918 posts / today 0 new / 48,278 members
DOS批处理 & 脚本技术(批处理室) » Can the delims= in for be a string?
Printable Version  6,508 / 29
Floor16 tobisome Posted 2007-10-19 19:46
中级用户 Posts 38 Credits 220
What is the difference between double exclamation marks and double percent signs?
I seem to see!n! in the do of for
Others like echo see %n%
Can you talk about this?
Floor17 lxmxn Posted 2007-10-19 19:47
版主 Posts 4,938 Credits 11,386
Floor18 handan Posted 2007-10-19 20:56
初级用户 Posts 12 Credits 30
tokens=1* What does this mean? I don't understand.
Floor19 moniuming Posted 2008-01-25 00:38
银牌会员 Posts 574 Credits 1,335 From 广西
Still, the moderator is really brilliant, I admire it
Floor20 komafd2 Posted 2008-02-22 16:15
初级用户 Posts 20 Credits 53
Tried it myself, using word as a delimiter
@ echo off
set "a=333ps555psssword=123 456 789"
for /f "tokens=1* delims=word" %%i in ("%a%") do set b=%%i&set num=%%j
echo %b:~0,-4% %num%
pause
Floor21 nanhui112 Posted 2008-03-07 21:52
初级用户 Posts 59 Credits 127
This question is worth studying... That is, when delims = string, in what way it is split.
Floor22 lovelymorning Posted 2008-03-08 14:24
初级用户 Posts 72 Credits 131
Make good use of variables, use more "substitution"
Floor23 huahua0919 Posted 2008-03-08 15:01
银牌会员 Posts 780 Credits 1,608
When delims= is a string: For example: If the string is abc, then the delimiters that play a splitting role are a, b, c, ab, ac, bc, abc. Those who have studied permutations and combinations will know that no matter the length of the character, the number of possible delimiters is always: Cn1 + Cn(n-1) +... + Cnn, there are so many possibilities!
Floor24 nanhui112 Posted 2008-03-08 22:56
初级用户 Posts 59 Credits 127
Can only be subjectively considered. I mean, what are the characteristics of the string when it is being split, and in what way is it split? I also know from experiments. For example, if the string in delims= has uniqueness, it will use the entire string of letters as the delimiter; otherwise, it will use the first character as the delimiter. It's not accurate enough. Hope the experts can point out!
Floor25 bjsh Posted 2008-03-09 15:41
银牌会员 Posts 621 Credits 2,000
Originally posted by nanhui112 at 2008-3-8 10:56 PM:
Can only be subjectively considered this way. I mean, what characteristics the string has when it is being split, and in what way it is split.
I also know from experiments. For example, if the characters in delims= have uniqueness...


"delims=abcedef"

No matter what the situation is, the splitting of delims is using each character after the equal sign as the delimiter.

It just seems to use the entire string as the delimiter when it is said to be "unique".
Floor26 wjmm Posted 2008-07-01 10:03
初级用户 Posts 19 Credits 48
After testing, it can also use a single Chinese character as a separator.
My understanding is that the separator is one byte

Originally posted by 26933062 at 2007-5-26 12:10 AM:
Oh. So that's the case. Does that mean it can only use a single letter or symbol as a separator?

[ Last edited by 26933062 on 2007-8-11 at 05:59 AM ]
Floor27 zh159 Posted 2008-07-02 08:55
金牌会员 Posts 1,467 Credits 3,687
Originally posted by wjmm at 2008-7-1 10:03:
After testing, it can also use a Chinese character as a separator,
My understanding is that the separator is one byte

As the 3rd floor said, it can only use a single letter or symbol as a separator, not a byte (one Chinese character is two bytes)
Floor28 wjmm Posted 2008-07-02 15:16
初级用户 Posts 19 Credits 48
After testing, the delimiter can be a Chinese character
For example, there is a text file test.txt, and its content is as follows
-------------------------------------------------------------------------------
111111You2222222You3333333333You4444444
55555You66666You7777777777777777777You88888
9999You00000YouaaaaaaaaYoubbbbbb
---------------------------------------------------------------------------------

Batch processing code
@echo off
FOR /F "tokens=1,3,4 delims=You" %%a in (test.txt) do @echo %%a %%b %%c
pause

After executing this batch processing, it can be found that the Chinese character "You" can indeed be used as a delimiter

Byte"

Originally posted by zh159 at 2008-7-2 08:55 AM:

As the 3rd floor said, it can only be a single letter or symbol as a delimiter, not a byte (a Chinese character is two bytes)


[ Last edited by wjmm on 2008-7-3 at 11:30 AM ]
Floor29 zzybq Posted 2009-10-29 12:16
初级用户 Posts 22 Credits 36 From 厦门
It's really good, I've learned something.
Floor30 Evangel Posted 2009-10-31 15:26
初级用户 Posts 95 Credits 145
The brother upstairs has an amazing ability to dig up old posts... After reading for a long time, I just realized it's a post from two years ago... But it's also very classic
Prev  1 2
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023