This is a migrated thread and some comments may be shown as answers.

Capitalize first character in string?

1 Answer 260 Views
Code Templates
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Frank Beerens
Top achievements
Rank 1
Frank Beerens asked on 27 Mar 2013, 02:55 PM
Dear Telerik,

i have the following template to generate a field with a propery within a single template. Problem now is i need to type the full fieldname and the full property name, while the only difference will be the first character, namelijk lowercase vs uppercase.
Is there any way to implement this in the template, so i can simply type the name once, and the template will capitalize the first letter of the property for me? Thanks!

Code generated:
private string example;  
        public string Example
        {
            get
            {
                return example;
            }
            set
            {
                if (example != value)
                {
                    example = value;            
                    OnPropertyChanged("Example");
                }
            }
        }



Template:
private $1$ $2$;
 
public $1$ $3$
{
 
    get
    {
        return $2=SELECT_VARIABLE($1$)$;
    }
    set
    {
        if($2$ != value)
        {
 
            $2$ = value;            
            OnPropertyChanged(\"$3$\");
        }
    }
}

1 Answer, 1 is accepted

Sort by
0
Zdravko
Telerik team
answered on 27 Mar 2013, 04:30 PM
Hello Frank,

 Thanks for contacting us.
I am afraid that we don't have such command yet. But I would suggest you something else.

private $1$ $3=SUGGEST_FRIENDLY_NAME($2$,field)$;
  
public $1$ $2$
{
  
    get
    {
        return $3$;
    }
    set
    {
        if($3$ != value)
        {
  
            $3$ = value;           
            OnPropertyChanged(\"$2$\");
        }
    }
}


It will provide you with a list of names and you can choose the right one.
If you still want other functionality than that please post a feature request with detailed description at our feedback portal.
Thanks.

Kind regards,
Zdravko
the Telerik team
Share what you think about JustCode with us, so we can help you even better! You can use the built-in feedback tool inside JustCode, our forum, or our JustCode feedback portal.
Tags
Code Templates
Asked by
Frank Beerens
Top achievements
Rank 1
Answers by
Zdravko
Telerik team
Share this question
or