Page 1 of 1
How to extract a character from a string in a script
Posted: 11 Feb 2013 11:25
by Velpreso
Hi, I would like to draw the first letter of the word TEST (T) but the script written by me is not working. Do you know how to fix it?
Code: Select all
setLocal EnableDelayedExpansion
set str=TEST
set string1=!str:~%1%!
echo %string1%
Re: Ho to fix this scrypt
Posted: 11 Feb 2013 12:17
by Squashman
setLocal EnableDelayedExpansion
set str=TEST
set string1=%str:~0,1%
echo %string1%
Re: Ho to fix this scrypt
Posted: 11 Feb 2013 12:37
by Velpreso
Thanks for help but there must be:
your code showing "EST" but thanks for help, now it work as should.
Re: Ho to fix this scrypt
Posted: 11 Feb 2013 12:38
by Squashman
Velpreso wrote:Thanks for help but there must be:
your code showing "EST" but thanks for help, now it work as should.
Yeah, I just realized that just before you posted. Code is fixed above.
Re: Ho to fix this scrypt
Posted: 11 Feb 2013 13:25
by Velpreso
I have one more question. Do you know of a script that will calculate how many letters in the word is? Or at least if it's possible?
Re: Ho to fix this scrypt
Posted: 11 Feb 2013 13:43
by Squashman