Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to display two characters and the characters between them in batch processing

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly shows you "how to display a certain two characters and the characters between them". The content is easy to understand and clear. I hope it can help you solve your doubts. Let me lead you to study and learn the article "how to display two characters and the characters between them".

The code is as follows:

:: for example, when I type af, it will show

:: a

:: b

:: c

:: d

:: e

:: f

:: each letter occupies a line.'I wonder if it can be realized.

@ echo off

::

::

: begin

Cls

Set str=a b c d e f g h i j k l m n o p q r st u v w x y z

Set input=

Set / p input= Please enter a letter range (such as af):

Call set str=%%str:%input:~0,1%=- ☆ input:~0,1%%%

Call set str=%%str:%input:~-1%=%input:~-1% ☆%

For / f "tokens=2 delims= ☆" I in ("str%") do set str=%%i

For I in (str%) do echo I

Pause

Goto begin

@ echo off

::

::

Set str=a b c d e f g h i j k l m n o p q r st u v w x y z

: begin

Cls

Set flag=0

Set var=

Set input=

Set / p input= Please enter a letter range (such as af):

For% I in (% str%) do call: pickup% I

: end

Pause

Goto begin

: pickup

If / I "% 1" = = "% input:~0,1%" set flag=1

If / I "% 1" = = "% input:~-1%" set flag=2

If flag% equ 1 echo 1

If flag% equ 2 echo 1&goto end

Goto: eof

@ echo off

Encode each element of the string before converting it

::

::

Setlocal enabledelayedexpansion

Set str=a b c d e f g h i j k l m n o p q r st u v w x y z

For% I in (% str%) do set/a dec+=1 & set% iConstrucdec! & set stringed declines%% I

Set en=

Set / p en= Please enter a letter range (such as af):

Set/a num 1 percent, enRom zero, zero zero, one percent, one hundred percent, one hundred percent!

For / l I in (num1%,1,%num2%) do echo! str%%i!

Pause > nul

Goto: eof

@ echo off

:: it is very limited to compare the size of the internal encoding of characters.

::

::

Setlocal enabledelayedexpansion

Set str=a b c d e f g h i j k l m n o p q r st u v w x y z

Set en=

Set / p en= Please enter a letter range (such as af):

Set str1=%en:~0,1%

Set str2=%en:~-1%

For I in (str%) do if I geq! str1! If I leq! str2! Echo I

Pause > nul

Goto: eof

@ echo off

Disadvantages: slow speed

::

::

: begin

Set / p a = "the old rules hee hee:"

Set str=a b c d e f g h i j k l m n o p q r st u v w x y z

For% I in (% str%) do echo%% I | findstr [% aVOR / 0min 1% Murray% aRom / 1%]

Pause

Goto begin

The above is all the contents of the article "how to display a certain two characters and the characters between them". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report