Dear experts, have you ever had the following experience~!
When making a batch processing table, if there are variables in it, such a table is always misaligned when writing. Because variables may be large or small.
Therefore, we always try to avoid using variables in the table when writing, but it is a pity to give up using variables in the table if a good batch processing is because of this.
I'm afraid it's not clear enough to say: for example.
Suppose there are several variables now.
set /p name=
set /p add=
set /p phone=
I need to draw a table on the screen.
┍━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ %name% %phone% ┃
┃ %add% ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
Just roughly represent it like this, then how do you deal with the problem of aligning the subsequent line with the top when you encounter such a situation?
Personally, I have an immature idea.. but I encountered a problem in dealing with Chinese and non-English issues.
It is known that the line for making the table occupies two characters, Chinese characters occupy one character, and English and various symbols occupy one character.
If the variables are all English or Chinese characters, then this idea is fine..
---------------------------------------------------------------------------------------------------------
1, Suppose I want to draw 37 table lines in one line, that is, a distance of 74 characters. Among them, the table will use 4 characters.
2, The space occupied by the variable, use for /l %%i in (0,1,1000) to obtain the number of characters of the variable. Make this number of characters not greater than 35 or 70.
3, Then use 35 or 70 minus this number. Obtain the number of spaces to be drawn to get the answer for the distance of the table border line.
---------------------------------------------------------------------------------------------------------
But, frequently, the variables we write are the result of Chinese + English. Then how to correctly obtain the real number of characters of the variable.
Hehe, I hope everyone can pool their ideas. Solve this difficult problem, and also hope everyone can draw a relatively beautiful menu (table) out.
Thank you youxi01, lxmxn. Let me learn new knowledge.
One is to get the file size, and the other is character judgment, (modify the assic a bit, it should be no problem probably)
[ Last edited by flyinspace on 2007-4-22 at 06:12 PM ]
When making a batch processing table, if there are variables in it, such a table is always misaligned when writing. Because variables may be large or small.
Therefore, we always try to avoid using variables in the table when writing, but it is a pity to give up using variables in the table if a good batch processing is because of this.
I'm afraid it's not clear enough to say: for example.
Suppose there are several variables now.
set /p name=
set /p add=
set /p phone=
I need to draw a table on the screen.
┍━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ %name% %phone% ┃
┃ %add% ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
Just roughly represent it like this, then how do you deal with the problem of aligning the subsequent line with the top when you encounter such a situation?
Personally, I have an immature idea.. but I encountered a problem in dealing with Chinese and non-English issues.
It is known that the line for making the table occupies two characters, Chinese characters occupy one character, and English and various symbols occupy one character.
If the variables are all English or Chinese characters, then this idea is fine..
---------------------------------------------------------------------------------------------------------
1, Suppose I want to draw 37 table lines in one line, that is, a distance of 74 characters. Among them, the table will use 4 characters.
2, The space occupied by the variable, use for /l %%i in (0,1,1000) to obtain the number of characters of the variable. Make this number of characters not greater than 35 or 70.
3, Then use 35 or 70 minus this number. Obtain the number of spaces to be drawn to get the answer for the distance of the table border line.
---------------------------------------------------------------------------------------------------------
But, frequently, the variables we write are the result of Chinese + English. Then how to correctly obtain the real number of characters of the variable.
Hehe, I hope everyone can pool their ideas. Solve this difficult problem, and also hope everyone can draw a relatively beautiful menu (table) out.
Thank you youxi01, lxmxn. Let me learn new knowledge.
One is to get the file size, and the other is character judgment, (modify the assic a bit, it should be no problem probably)
[ Last edited by flyinspace on 2007-4-22 at 06:12 PM ]
知,不觉多。不知,乃求知
