[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gcmd-dev] HEAD+DEV: New python-like indices for advanced file rename te
From: |
Piotr Eljasiak |
Subject: |
[gcmd-dev] HEAD+DEV: New python-like indices for advanced file rename templates |
Date: |
Thu, 03 Aug 2006 00:06:54 +0200 |
Hi folks,
I've just committed (to both branches) some advrename enhancements -
advrename now accepts new method for accessing part of template
placeholders - ranges (python-like indices). Here goes excerpt from gcmd
help docs:
Ranges are a method of accessing a part of a string. The concept
of ranges is based on python slices.
A range (start_index:end_index) starts at the start_index and
finishes one character before the end_index.
Range syntax
* (start_index:end_index)
* (start_index) ≡ (start_index:)
* (start_index,length) ≡ (start_index:start_index+length)
If any of the indices is dropped, it is assumed that you want
everything in that direction. I.e. (:3) means "every character
from the beginning of the string up to character 3,
non-inclusive." (3:) would, on the other hand, mean "every
character from the string, starting at character 3 (inclusive)
up to, and including, the last one." If index is negative, it is
relative to the end of the string. Index -3 stands for "the
third character from the end of the string".
Note: Position of the first letter is '0'.
Although I believe it should work without any serious problems - please
stress it as much as possible ;o)
BTW - advrename dialog has got 'Help' button for the list of template
placeholders (like $n, $p, etc.) and strftime controls
Enjoy,
Piotr
- [gcmd-dev] HEAD+DEV: New python-like indices for advanced file rename templates,
Piotr Eljasiak <=