See below example in python.
your_string="Hello"This will give output as,
for c in your_string :
print (c)
H
e
l
l
o
We can do same thing in bash shell scripting also,
see below bash shell scripting example.
#getting ord value of chars. your_string="Hello"
echo $your_string | awk -v ORS="" '{ gsub(/./,"&\n") ; print }' | \
while read char
do
echo $char
done
Cheers.... ! Happy looping through the string !
0 comments:
Post a Comment
Ask anything about this Tutorial.