MetaCase Homepage
Forum Home Forum Home > > MetaEdit+
  New Posts New Posts RSS Feed - How to convert capital letter to lowercase?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to convert capital letter to lowercase?

 Post Reply Post Reply
Author
Message
Jiarui View Drop Down
Contributor
Contributor
Avatar

Joined: 17.May.2013
Location: China
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote Jiarui Quote  Post ReplyReply Direct Link To This Post 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')?
Back to Top
stevek View Drop Down
MetaCase
MetaCase
Avatar

Joined: 11.Mar.2008
Points: 643
Post Options Post Options   Thanks (0) Thanks(0)   Quote stevek Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Jiarui View Drop Down
Contributor
Contributor
Avatar

Joined: 17.May.2013
Location: China
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote Jiarui Quote  Post ReplyReply Direct Link To This Post 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?
Back to Top
stevek View Drop Down
MetaCase
MetaCase
Avatar

Joined: 11.Mar.2008
Points: 643
Post Options Post Options   Thanks (0) Thanks(0)   Quote stevek Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.05
Copyright ©2001-2022 Web Wiz Ltd.

This page was generated in 0.031 seconds.