Page 1 of 1

print (or search) a single char in a string

Posted: Thu May 12, 2016 8:45 pm
by pasbel
Hi
Is it possible to print (or search) a single char in a string ?

I've try a lot of things, like this for example for third char :

my_string = "pixilang"
print ( my_string[2] , 0 , 0 , WHITE, TOP|LEFT )

but I can't...

I can only print ascii code after num to string conversion...

Re: print (or search) a single char in a string

Posted: Fri May 13, 2016 10:19 am
by NightRadio
print can understand only the containers.
So here is the code :)

Code: Select all

my_string = "pixilang"
ts = " "
ts[ 0 ] = my_string[ 2 ]
print ( ts, 0 , 0 , WHITE, TOP|LEFT )

Re: print (or search) a single char in a string

Posted: Sun May 15, 2016 12:11 pm
by pasbel
It works !
Many thanks