Advertisement
Axg1010

Untitled

Aug 29th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. Create a function called "CreateFromDescription" that takes a single string parameter as input (called "descrip"). A well-formed description *should* be in the following format (no quotes):
  2.  
  3. "Channel Operation [StartEvent - EndEvent]"
  4.  
  5. The function should parse the description into 4 separate string: Channel, Operation, StartEvent, and EndEvent. The function should print to the screen each with a label:
  6. Channel: Channel
  7. Operation: Operation
  8. Start Event: StartEvent
  9. End Event: EndEvent
  10.  
  11. Things to Note:
  12. -3 of the substrings (Channel, StartEvent, and EndEvent) may or may not contain spaces (see examples below). Operation will never contain spaces.
  13. -Users/Callers of this function might call the function with a malformed description The function should validate the input by ensuring the descrip parameter adheres to the above well-formed format of a description (and print an error message if it does not).
  14.  
  15. Well-Formed Description Examples:
  16. Crown Temp Max [Start Of Weld - End Of Weld]
  17. Weld Shear Angle Target Min [Start Of Weld - Welding]
  18.  
  19. Malformed Desciption Examples:
  20. Hello World
  21. Crown Temp Max [Start Of Weld - End Of Weld
  22. Crown Temp Max [Start Of Weld End Of Weld]
  23. Crown Temp Start Of Weld End Of Weld]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement