You Are Here:

Community: Developer Discussion Boards

#1 Old how to string manipulation? - 2007-11-25, 21:11

Join Date: Jun 2007
Posts: 54
rsf
Offline
Regular Contributor
Im looking for a help. How to learn string manupulation in pys60.

I want to:

__variable = "hello world"

LEFT(__variable, 2) ---> he
RIGHT(__variable,2) ---> ld
parametercount(__variable,' ') ---> 2
parametervalue(__variable,1,' ') ---> hello
substring(__variable,7,5) --->world

anybody can help?
Reply With Quote

#2 Old Re: how to string manipulation? - 2007-11-26, 07:33

Join Date: May 2004
Posts: 524
Location: Tampere, Finland
jethro.fn's Avatar
jethro.fn
Offline
Forum Nokia Champion
Quote:
Originally Posted by rsf View Post
Code:
__variable = "hello world"

1. LEFT(__variable, 2)  ---> he
2. RIGHT(__variable,2)  ---> ld
3. parametercount(__variable,' ')  ---> 2 
4. parametervalue(__variable,1,' ') ---> hello
5. substring(__variable,7,5) --->world
These are basic Python questions and not about PyS60. I suggest you read an introductory book to Python, such as the freely available Dive Into Python.

Anyway, most of your questions can be answered with list (and string) splicing:

Code:
1. __variable[:2]
2. __variable[-2:]
3. len(__variable.split())
4. __variable.split()[0]
5. __variable[6:11]    # Python counts from 0.
Reply With Quote

#3 Old Re: how to string manipulation? - 2007-11-26, 15:49

Join Date: Jun 2007
Posts: 54
rsf
Offline
Regular Contributor
Hi jethro! You again!



Its seems String handling in python is much more simplier than the VISUAL BASIC Im using.

Thank you! a lot of thanks!
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use Gauge/Process Bar when using HttpConnection? Tanya Mobile Java Networking & Messaging & Security 2 2006-12-28 08:59
Basic String Manipulation Problem hong.lam General Symbian C++ 5 2006-11-07 11:51
String manipulation in Symbian. khurshed79 General Symbian C++ 3 2005-08-09 08:48
Personal JSmith77 PersonalJava 4 2003-07-30 13:52
D211 new linux driver 1.04 not working !! franz_meyer Multimodecards 1 2002-12-12 09:31

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia