In DOS, a string is an ordered collection of characters, such as "Hello, World!".
S.No | Strings & Description |
---|---|
1 | Create String
A string can be created in DOS in the following way. |
2 | Empty String
Empty String |
3 | String Interpolation
String interpolation is a way to construct a new String value from a mix of constants, variables, literals, and expressions by including their values inside a string literal. |
4 | String Concatenation
You can use the set operator to concatenate two strings or a string and a character, or two characters. Following is a simple example which shows how to use string concatenation. |
5 | String length
In DOS scripting, there is no length function defined for finding the length of a string. There are custom-defined functions which can be used for the same. Following is an example of a custom-defined function for seeing the length of a string. |
6 | toInt
A variable which has been set as string using the set variable can be converted to an integer using the /A switch which is using the set variable. The following example shows how this can be accomplished. |
7 | Align Right
This used to align text to the right, which is normally used to improve readability of number columns. |
8 | Left String
This is used to extract characters from the beginning of a string. |
9 | Mid String
This is used to extract a substring via the position of the characters in the string. |
10 | Remove
The string substitution feature can also be used to remove a substring from another string. |
11 | Remove Both Ends
This is used to remove the first and the last character of a string. |
12 | Remove All Spaces
This is used to remove all spaces in a string via substitution. |
13 | Replace a String
To replace a substring with another string use the string substitution feature. |
14 | Right String
This is used to extract characters from the end of a string. |