Capitalize first character in string?

2 posts, 0 answers
  1. Frank Beerens
    Frank Beerens avatar
    26 posts
    Member since:
    Jan 2010

    Posted 27 Mar 2013 Link to this post

    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$\");
            }
        }
    }
  2. Zdravko
    Admin
    Zdravko avatar
    657 posts

    Posted 27 Mar 2013 Link to this post

    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.
  3. DevCraft banner
Back to Top