[Lldb-commits] [lldb] Add new Python API `SBCommandInterpreter::GetTranscript()` (PR #90703)

via lldb-commits lldb-commits at lists.llvm.org
Fri May 10 13:34:05 PDT 2024


================
@@ -290,6 +290,31 @@ class StructuredData {
 
     void GetDescription(lldb_private::Stream &s) const override;
 
+    /// Creates an Array of substrings by splitting a string around the
+    /// occurrences of a separator character.
+    ///
+    /// \param[in] s
+    ///   The input string.
+    ///
+    /// \param[in] separator
+    ///   The character to split on.
+    ///
+    /// \param[in] maxSplit
+    ///   The maximum number of times the string is split. If \a maxSplit is >=
+    ///   0, at most \a maxSplit splits are done and consequently <= \a maxSplit
+    ///   + 1 elements are returned.
+    ///
+    /// \param[in] keepEmpty
+    ///   True if empty substrings should be returned. Empty substrings still
+    ///   count when considering \a maxSplit.
+    ///
+    /// \return
+    ///   An array containing the substrings. If \a maxSplit == -1 and \a
+    ///   keepEmpty == true, then the concatination of the array forms the input
+    ///   string.
+    static ArraySP SplitString(llvm::StringRef s, char separator,
+                               int maxSplit = -1, bool keepEmpty = true);
+
----------------
royitaqi wrote:

Same as the above.
> Removed the split, and the utility function. Now `StructuredData.h/.cpp` are unchanged.

https://github.com/llvm/llvm-project/pull/90703


More information about the lldb-commits mailing list