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 » Thu May 12, 2016 8:45 pm

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: 2807
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 » Fri May 13, 2016 10:19 am

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 » Sun May 15, 2016 12:11 pm

It works !
Many thanks

Post Reply