Rebel_no_1
asked on
How to remove characters from a string
I hope I can explain this properly as this is an extremely basic question.
Three DOS environment variables gets generated by a bat file. For example:
STRINGA=1234567890
STRINGB=1234567890
STRINGC=1234567890
A) What command must I run to remove the first three characters form STRINGA?
B) What command must I run to remove the last three characters from STRINGB?
C) What command must I run to remove the first and last three characters from STRINGC?
I want to end up with:
STRINGA=4567890
STRINGB=1234567
STRINGC=4567
Please note that the three variables may be letters or characters.
Three DOS environment variables gets generated by a bat file. For example:
STRINGA=1234567890
STRINGB=1234567890
STRINGC=1234567890
A) What command must I run to remove the first three characters form STRINGA?
B) What command must I run to remove the last three characters from STRINGB?
C) What command must I run to remove the first and last three characters from STRINGC?
I want to end up with:
STRINGA=4567890
STRINGB=1234567
STRINGC=4567
Please note that the three variables may be letters or characters.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you. I prefer answers to be posted directly and have therefore split the points between you two. Both of you are 100% correct in your answers though. Thank you, your help is always very much appreciated.
ASKER
Thank you for the extra info Qlemo. I will definitely consider that in the future. I believe my judgement was pretty good considering that I did not know EE's policies. In future there will be more than a one point difference. :-) Still, thanks to both of you.
ASKER
::########################
Set STRINGA=1234567890
Set STRINGB=1234567890
Set STRINGC=1234567890
(Command to remove 123 from STRINGA)
(Command to remove 890 from STRINGB)
(Command to remove 123890 from STRINGC)
ECHO %STRINGA%
ECHO %STRINGB%
ECHO %STRINGC%
::########################
The three ECHO's should yield the new environment values. Ok, I'm sure this is 100% clear now... :-)