StringFormatQ

Listing of Formats »

StringFormatQ["string","fmt"]

gives True if the string "string" might be imported as format "fmt" and gives False otherwise.

StringFormatQ["string",{"fmt1","fmt2",}]

gives True if "string" might be imported as one of "fmti".

Details

  • StringFormatQ attempts to identify whether a string can be imported as a specific format.
  • StringFormatQ uses heuristic methods and may not give correct results, particularly for shorter strings.
  • StringFormatQ does not verify that ImportString would succeed if applied to "string".

Examples

Basic Examples  (1)

Export an image to a GIF string:

Check if the string might be a GIF:

Check if the string might be a JPEG:

Check if the string might be in one of the image formats:

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

Text

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

CMS

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

APA

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

BibTeX

@misc{reference.wolfram_2023_stringformatq, author="Wolfram Research", title="{StringFormatQ}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/StringFormatQ.html}", note=[Accessed: 29-March-2024 ]}

BibLaTeX

@online{reference.wolfram_2023_stringformatq, organization={Wolfram Research}, title={StringFormatQ}, year={2020}, url={https://reference.wolfram.com/language/ref/StringFormatQ.html}, note=[Accessed: 29-March-2024 ]}