Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

C# String Function Package Recommendations?

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

    C# String Function Package Recommendations?

    Hi all - I'm doing some C# coding in Ninja and was wondering if anyone could recommend a function package library that would include some string parsing/handling capabilities. Parsing, subword(s), counting words, etc., etc., etc.

    Free would be nice, but I might buy something, if it had the right stuff in it.

    I don't want to have to spend a lot of time learning my way around the C# world if what I need is already available.

    Thanks...

    #2
    Hello,

    Thank you for the post.

    What specifically are you trying to do in terms of parsing? I really couldn't suggest using an external library for simple string manipulation, C# has excellent string manipulation capabilities already built into the language. You can find some of what a string is capable of in C# in the following document: https://msdn.microsoft.com/en-us/lib...v=vs.113).aspx

    These methods all apply to a string, but there are certainly other options for comparisons depending on the needs.

    In contrast to learning C#, I would actually advise you try to learn the basics of C# instead of going right to other libraries that may offer specific capabilities. Often using just C# will provide the most simple solution and is easier to understand than trying to wire up an external library. When you involve extra libraries this adds extra levels of complexity to debugging your script.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thanks for the response. I perused the url you indicated and see there are a lot of string related items listed.

      An example of what I need to do is a simple Subword function. Return the nth word of a string.

      I'll probably start with this code excerpt that was listed about halfway down the list:

      string sentence = "This sentence has five words.";
      // Extract the second word.

      int startPosition = sentence.IndexOf(" ") + 1;
      string
      word2 = sentence.Substring(startPosition, sentence.IndexOf(" ", startPosition) - startPosition);
      Console.WriteLine("Second word: " + word2);
      // The example displays the following output:
      // Second word: sentence


      This should do the trick. However, what really surprises me is that if C# is one of the "languages of the future" kinda thing, how come there isn't a simple function like this:


      String = "word1 word2 word3 word4";
      StuffIneed = SubWord(String, 3);


      Simple, easy, one-liner.

      I was using coding like this in 1980 in the BASIC language. Later in many other languages.

      Sometimes simple = the way to go.

      I don't know C#, don't wanna have to spend a lot of time getting spec'd up just to do some simple Ninja coding.
      Last edited by AMATX; 02-08-2018, 10:23 AM.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by alifarahani, Today, 09:40 AM
      6 responses
      38 views
      0 likes
      Last Post alifarahani  
      Started by Waxavi, Today, 02:10 AM
      1 response
      17 views
      0 likes
      Last Post NinjaTrader_LuisH  
      Started by Kaledus, Today, 01:29 PM
      5 responses
      14 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by Waxavi, Today, 02:00 AM
      1 response
      12 views
      0 likes
      Last Post NinjaTrader_LuisH  
      Started by gentlebenthebear, Today, 01:30 AM
      3 responses
      17 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Working...
      X