[Tutor] string fomatting
denis.spir at free.fr
Sat Jan 31 20:56:47 CET 2009
Le Sun, 1 Feb 2009 02:44:02 +0800,
Jay Jesus Amorin <jay.amorin at gmail.com> a écrit :
> Thanks bob.
> I want to search any characters in test after
> the search will end after it finds another /
> and when i print it will display *testmodule*.
I think your question is not of string formatting, rather of string parsing, meaning identifying parts of string according to a given format.
I your case, you want a function that able to extract a substring that:
* starts with "test"
* ends with "/"
You can do this step by step using simple string method 'find', and slicing:
* find the (position of the) first occurrence of "test"
* find the (position of the) first occurrence of "/", after "test"'s position
* extract the slice defined by these positions
la vida e estranya
More information about the Tutor