How to convert numbers to the first letters of the alphabet? . I want to use this code for me. But I need alphabets for 10,11,12,13 etc. for example if the user will enter 10 , the program will print j for 11 -->"k" . How cam I do this.
My code is same in the link above
2 Answers
You can use this BASH function:
cnvt() { printf "\x$(printf '%x' $((97 + $1 -1)))\n"; }
Test it:
cnvt 10
j
cnvt 11
k
cnvt 26
z
3 Comments
anubhava
What I have in my answer is indeed the shell script. Just add my given inside any shell script and use it the way I suggested here.
esrtr
for example , when I write 35 , it gives me 'z' .Is it possible ? I know when I write 26 i gives 'z' . but ıt is possible for in ascii codes ?
anubhava
cnvt 35 prints a printable character i.e. ASCII code 132
printf \\\x$(printf '%x' input). For example:for input in {1..26}; do printf \\\x$(printf '%x' $((input+96))); done.