![]() |
How to convert capital letter to lowercase? |
Post Reply
|
| Author | |
Jiarui
Contributor
Joined: 17.May.2013 Location: China Points: 14 |
Post Options
Thanks(0)
Quote Reply
Topic: How to convert capital letter to lowercase?Posted: 21.Feb.2014 at 16:06 |
|
Hi,
When I define the generator, I used to use the same property sometimes capital letter but sometimes lowercase, I want to know how to convert capital letter to lowercase(for example I want to convert 'user' to 'User')?
|
|
![]() |
|
stevek
MetaCase
Joined: 11.Mar.2008 Points: 643 |
Post Options
Thanks(0)
Quote Reply
Posted: 21.Feb.2014 at 16:11 |
|
You can do that with a translator. Several are already defined in the _translators generator in Graph, and you can use them, learn from them, and add new ones. If you call _translators() at the start of your generator, you can use them, e.g. :MyProperty%lower
|
|
![]() |
|
Jiarui
Contributor
Joined: 17.May.2013 Location: China Points: 14 |
Post Options
Thanks(0)
Quote Reply
Posted: 23.Feb.2014 at 14:35 |
|
First, Thank you very much, I define a generator like this:
to '%upper /^[a-z]/ [A-Z]' endto I want the first lowercase of the property to change to it's corresponding upper letter. It doesn't work, Could you tell me why?
|
|
![]() |
|
stevek
MetaCase
Joined: 11.Mar.2008 Points: 643 |
Post Options
Thanks(0)
Quote Reply
Posted: 23.Feb.2014 at 15:19 |
|
Search for firstUpper here on the forums, I've just updated the post to show an easy way in 5.0.
Your way doesn't work because the left-hand side and right-hand side aren't legal translator syntax: since the left-hand side is a regular expression, the right-hand side would have to be a string, so prefixed by $, not a character range (which wouldn't have [] brackets around it in any case). You can only have a character range on the right if you have a similar-sized set of characters or character range on the left (not a string or regular expression): e.g. a-z A-Z has 26-character ranges on both the left and right. Edited by stevek - 23.Feb.2014 at 15:24 |
|
![]() |
|
Post Reply
|
|
| Tweet |
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |