Book a Demo

Author Topic: Code Generation Templates, String to Lower Case  (Read 4117 times)

Q-Man

  • Guest
Code Generation Templates, String to Lower Case
« on: June 01, 2007, 01:56:39 am »
Hi,

I want to edit the Code generation template for ActionScript. The linked attribute declaration should use the class name of the linked attribute, but the first letter should be lower case.

How is it possible to edit a string in that way with the code template scripting language?

Thanx
Q-Man


«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Code Generation Templates, String to Lower Cas
« Reply #1 on: June 01, 2007, 03:13:41 am »
I'm not sure if you can do this at the scripting level Q-Man. I have a different situation, but the need to manipulate such strings will become pressing.

However, you may be able to easily solve your problem without going through much pain.

Take a look at the Tools | Options | Source Code Engineering dialog. Right at the bottom you'll find several settings that control how EA translates attributes into properties. Experiment a bit and you can probably get the results you want.

David
No, you can't have it!

Q-Man

  • Guest
Re: Code Generation Templates, String to Lower Cas
« Reply #2 on: June 01, 2007, 03:41:51 am »
Thank you, but there's no option for that. Or do you know a special trick? ;)

thomaskilian

  • Guest
Re: Code Generation Templates, String to Lower Cas
« Reply #3 on: June 01, 2007, 05:09:17 am »
Search for EXEC_ADD_IN - that allows a lot of tricky things.
« Last Edit: June 01, 2007, 05:10:01 am by thomaskilian »

Q-Man

  • Guest
Re: Code Generation Templates, String to Lower Cas
« Reply #4 on: June 01, 2007, 07:00:04 am »
hey, thanx, but i found an easy way with the scripting language:

Code: [Select]

$first=%LEFT(linkAttName, 1)%
$firstLower=%TO_LOWER($first)%
$rest=%MID(linkAttName, 1)%
$new=$firstLower+$rest


$new is the linkAttName with lower case first letter.

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Code Generation Templates, String to Lower Cas
« Reply #5 on: June 01, 2007, 07:10:36 am »
Thanks much Q-Man. You've saved me a bundle of trouble.

David
No, you can't have it!