WOLFRAM

Enable JavaScript to interact with content and submit forms on Wolfram websites. Learn how
Wolfram Language & System Documentation Center

InString [n]

is a global object that is assigned to be the text of the n^(th) input line.

Details
Details and Options Details and Options
Examples  
Basic Examples  
Scope  
Properties & Relations  
See Also
Tech Notes
Related Guides
History
Cite this Page

InString [n]

is a global object that is assigned to be the text of the n^(th) input line.

Details

  • InString [n] gives the string that the Wolfram Language read for the n^(th) input line. In a text-based interface, the string includes all intermediate newlines in the input, but not the newline at the end.
  • In a notebook interface, InString will typically return a string representing a typeset expression.
  • The value of InString [n] is assigned after the input is verified to be syntactically correct, and after any function given as the value of $PreRead has been applied.
  • InString [] gives the text of the last input line.
  • InString [-k] gives the text of the input k lines back.

Examples

open all close all

Basic Examples  (1)

Show input as a string:

With StandardForm input, the string represents a typeset expression:

Scope  (1)

Create three inputs:

Retrieve the first input string:

Get the next-to-last input string:

Properties & Relations  (1)

InString returns a string:

In StandardForm , calling ToExpression on the result will return a typeset expression:

MakeExpression converts the typeset expression to the input expression:

See Also

In   $SyntaxHandler   $Echo

History

Introduced in 1991 (2.0)

Wolfram Research (1991), InString, Wolfram Language function, https://reference.wolfram.com/language/ref/InString.html.

Text

Wolfram Research (1991), InString, Wolfram Language function, https://reference.wolfram.com/language/ref/InString.html.

CMS

Wolfram Language. 1991. "InString." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/InString.html.

APA

Wolfram Language. (1991). InString. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/InString.html

BibTeX

@misc{reference.wolfram_2025_instring, author="Wolfram Research", title="{InString}", year="1991", howpublished="\url{https://reference.wolfram.com/language/ref/InString.html}", note=[Accessed: 12-January-2026]}

BibLaTeX

@online{reference.wolfram_2025_instring, organization={Wolfram Research}, title={InString}, year={1991}, url={https://reference.wolfram.com/language/ref/InString.html}, note=[Accessed: 12-January-2026]}

Top [フレーム]

AltStyle によって変換されたページ (->オリジナル) /