Skip to content

Conversation

@daniil-loban
Copy link
Contributor

@daniil-loban daniil-loban commented Oct 23, 2025

Features for text:

split node that allows splits a String Value and returns a Vec of strings:

  • in String Value: "a;b;c" (from a csv file or a http request)
  • param delimeter: ";"
  • out: vec!["a","b","c" ]

@TrueDoctor
Copy link
Member

Sorry that I didn't see this pr earlier, feel free to just request a review from me in the future. I made a few changes to your pr let me know if you disagree with any of these

@daniil-loban
Copy link
Contributor Author

I agree with changes!


// Get an indexed part of string whitch separated a specified delimeter ("1;2;3" e.t.c.)
#[node_macro::node(category("Text"))]
fn substring_by_index(_: impl Ctx, string: String, #[default("\\n")] delimeter: String, index: u32) -> String {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if this node name should include split since we split by the substring and don't index by it. @Keavon opinions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We split the string and take the value by index, perhaps for optimization it is better if it is 2 nodes.

@Keavon
Copy link
Member

Keavon commented Oct 29, 2025

I suggest we allow Vec<String> to be a supported type so we can use the existing count and index nodes.

@daniil-loban
Copy link
Contributor Author

I suggest we allow Vec<String> to be a supported type so we can use the existing count and index nodes.

The main goal was to process strings as arrays or other structures (in the case of JSON, but the code for it is not posted, there the path to the data is used to extract the string or number), if it is possible to use node polymorphism, for example, counting elements or calculating the size of a string vector, with existing nodes (Count Elements e.t.c.), this will be cool and intuitive.

@Keavon
Copy link
Member

Keavon commented Oct 29, 2025

Yes, their monomorphized forms just have to be added to the #[implementations(...)] of each node that'll work with a vec of strings.

@TrueDoctor
Copy link
Member

image

@TrueDoctor
Copy link
Member

!build

@TrueDoctor TrueDoctor changed the title Add two nodes for substring Add text split node Nov 2, 2025
@github-actions
Copy link

github-actions bot commented Nov 2, 2025

📦 Build Complete for 4336642
https://5a7523d2.graphite.pages.dev

@TrueDoctor TrueDoctor force-pushed the text_extract_by_delimeters branch from c1845d7 to ab969ee Compare November 2, 2025 09:47
@Keavon Keavon changed the title Add text split node New node: String Split Nov 3, 2025
@Keavon Keavon enabled auto-merge (squash) November 3, 2025 20:38
@Keavon Keavon merged commit 0d8c521 into GraphiteEditor:master Nov 3, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants