print (or search) a single char in a string

Pixilang programming language
Post Reply
pasbel
Posts: 18
Joined: Mon Jul 02, 2012 2:19 pm

print (or search) a single char in a string

Post 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...
User avatar
NightRadio
Site Admin
Posts: 3941
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

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

Post 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 )
pasbel
Posts: 18
Joined: Mon Jul 02, 2012 2:19 pm

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

Post by pasbel »

It works !
Many thanks
Post Reply