15,897,518 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by gmf (Top 2 by date)
gmf
13-Feb-11 11:35am
View
Thanks for every one's input for my question.
I am developing a tool to allow users to do a few things and I used command design pattern.
Users can use my tool to add user, add product, add file, ect to the database. The use use command line to run the tool like this:
>AddUser FirstName="" LastName="" MiddleName=""
>AddFile FileLocation=""
>AddProduct Name="" Price=""
...
So I have comamnds such as AddUser, AddFile and AddProduct. I am looking for a very generic way to parse inputs for all the commnads, at the mean time also handle spaces, ' "".
So I can not use any string functions. This is what I am doing:
In each command, I have properties, those properties will be the user's input. For each example,
AddUser command has properties such as FirstName, MiddleName, and LastName.
When I get the user's input, first I need to figure out which command it is, then I found all the properties from the command, use the name of property to get its value from the input string. So I really did not hard coded any thing.
gmf
12-Feb-11 12:54pm
View
Hi Manfred,
Thanks for the link. I read this link before, still can not figure it out.
I want to get all the information from the input string including Sid, but I only can do it one parameter at each time.
If I want to get all the parameters at one time, I works. The space bewteen the parameter name and = cause the problem. My pattern can not handle it.