MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / extract_strings

Function extract_strings

src/textcode/strings2.py:72–87  ·  view source on GitHub ↗

Yield unicode strings (ASCII and UTF-16-LE encoded ASCII) from a buf string of binary data. :param buf: A bytestring. :type buf: str :param n: The minimum length of strings to extract. :type n: int :rtype: Sequence[string]

(buf, n=3)

Source from the content-addressed store, hash-verified

70
71
72def extract_strings(buf, n=3):
73 """
74 Yield unicode strings (ASCII and UTF-16-LE encoded ASCII) from a buf string
75 of binary data.
76
77 :param buf: A bytestring.
78 :type buf: str
79 :param n: The minimum length of strings to extract.
80 :type n: int
81 :rtype: Sequence[string]
82 """
83 for s in extract_ascii_strings(buf):
84 yield s
85
86 for s in extract_unicode_strings(buf):
87 yield s

Callers

nothing calls this directly

Calls 2

extract_ascii_stringsFunction · 0.85
extract_unicode_stringsFunction · 0.85

Tested by

no test coverage detected