This project is read-only.

Cool way of accepting arguments

Topics: Off Topic, Other, Using Cosmos (Developing your own OS, projects, etc)
Jun 2, 2014 at 11:16 AM
Edited Jun 2, 2014 at 11:17 AM
Hey, why you don't use "Substring()" like
(Just an example from my TUI xD)
    if (cmd.Substring(0, 3).ToLower() == "get")
    {
                switch (cmd.Substring(4).ToLower())
                {
                    case "date":
                        //Do Something
                        break;
                    default:
                        //Do Something
                       break;
                }
    }
Jun 2, 2014 at 1:51 PM
Definitely more efficient, as substring instantiates the new string at once (at least it should) instead of concat-ing 1 character at a time..



2014-06-02 14:48 GMT+02:00 MisirianSoft <[email removed]>:

From: MisirianSoft

Wow that looks a bit easier than what I had to do...
Is that method more efficient (for my method if a string is long then it will take longer because of the while loop, does string.substring() use a while loop)?


Read the full discussion online.

To add a post to this discussion, reply to this email ([email removed])

To start a new discussion for this project, email [email removed]

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Jun 2, 2014 at 2:04 PM
@Misirian: your code is calling string concat as many time it split string and this implies it is instantiating array many times and using memory much...so very slow comparatively substring...for more info look at cosmos plug of substring