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".
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
open all close allBasic Examples (1)
Export an image to a GIF string:
str = ExportString[RadialGradientImage[Hue, 8, "Byte"], "GIF"]Check if the string might be a GIF:
StringFormatQ[str, "GIF"]Check if the string might be a JPEG:
StringFormatQ[str, "JPEG"]Check if the string might be in one of the image formats:
StringFormatQ[str, {"PNG", "GIF", "JPEG"}]Related Guides
History
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_2026_stringformatq, author="Wolfram Research", title="{StringFormatQ}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/StringFormatQ.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_stringformatq, organization={Wolfram Research}, title={StringFormatQ}, year={2020}, url={https://reference.wolfram.com/language/ref/StringFormatQ.html}, note=[Accessed: 12-June-2026]}