Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

is there a way to define a constant to be a string of repeated characters

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    is there a way to define a constant to be a string of repeated characters

    is there a way to define a constant to be a character repeated 20 times,
    which might look something like the following?

    public string NewVariable( " ",20);

    #2
    Hello,

    Yes simply by adding the const keyword it then could not be changed.However you would need to set it manually be be the 20 charactors.



    public const string MyConstString = "aaaaaaaaaaaaaaaaaaaaaaaa";

    If your asking something else let me know.
    BrettNinjaTrader Product Management

    Comment


      #3
      Originally posted by joemiller View Post
      is there a way to define a constant to be a character repeated 20 times,
      which might look something like the following?

      public string NewVariable( " ",20);
      Joe,

      You asked this very question some time back, at which time I gave you this response.

      ref: https://www.ninjatrader.com/support/...d.php?p=335725

      IOW, yes you can.

      Comment


        #4
        thanks brett and koganam.

        yea, I know, it's embarrassing how I forget something you told me june22, only six months ago. can't blame it on my 82 years because I have been that way all my life. I was introduced to programming 3 or so years ago and am now aware that possibly my brain may not be wired for serious programming. however, doesn't matter ... i persist because I love the power of software and the internet and actually enjoy doing this. drive defensively because you are a good resource and i would hate to lose you.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        560 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        325 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        547 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        547 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X