11.07.2015 Views

Advanced Programming Guide

Advanced Programming Guide

Advanced Programming Guide

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

190 • Chapter 4: Input and Outputincorrect syntax in parse:errorDescription (errorLocation)The errorDescription describes the nature of the error (for example, ‘+‘unexpected, or unexpected end of input). The errorLocation gives theapproximate character position within the string at which Maple detectedthe error.When you call parse from the Maple prompt, Maple displays theparsed result depending on whether the call to parse ends in a semicolonor a colon. The string passed to parse does not require a trailingsemicolon or a colon. If included, it is ignored.> parse("a+2+b+3");a + 5 + b> parse("sin(3.0)"):> %;0.1411200081Formatted Conversion to and from StringsThe sprintf and sscanf commands are similar to fprintf/printf andfscanf/scanf, except that they read from or write to Maple strings insteadof files.Call the sprintf command using the following syntax.sprintf( format, expressionSequence )The format specifies how Maple is to format the elements of the expressionSequence.This Maple string consists of a sequence of formattingspecifications, possibly separated by other characters. For more information,see section 4.6 on page 181.The sprintf command returns a string containing the formatted result.Call the sscanf command as follows.sscanf( sourceString, format )The sourceString provides the input for scanning. The format specifieshow Maple is to parse the input. A sequence of conversion specifications

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!