String manipulation - insert character in middle of string


Can someone help me how to insert character ( in my example I need to insert “period” ) in cells in Column A in the middle, but only in cells which have “Ford” in column C.

I uploaded a picture of my table. Result should be like 245.447 instead 245447 in first row.
Maybe sometime I will have to insert some other character like $, #…

Thanks :slight_smile:


Hello @rsamec and welcome to the KNIME community

I’m not sure if I fully understand the challenge; a table with expected output would be great, even if the description is completely accurate.

I would proceed first with a Rule Engine (%prediction%) aiming to index $C$ == Ford …

$C$ LIKE "Ford" => TRUE

Then a String Manipulation ($new column$) to type the desired output:

	substr($A$, 0, 3)
	, "period"
	, substr($A$, 2, 3)

And finally a second Rule Engine to conditionally re-type column $A$

$prediction$ = TRUE => $new column$
TRUE => $A$




Thanks on quick answer. Result needs to be like in your picture. If value in column C is “Ford” than insert “period” in column A. Don’t understand why we need new prediction column?

Whole thing is I need to compare 2 sets of data from excel, but unique key is a little different in these sets of data so I need to clean or modify at first. One thing is this what you solve, to put “period” (fullstop) in the middle but only if value “Ford” is in Column C.
With “column expression” node I replaced some characters in one set of data.
Maybe is this possible to do with column expression? So in one node i could have bunch of rules to modify data.


1 Like

Note that if column A is of variable length, you are better off switch over to a String Manipulation or Column Expression node and use the length() function. You can nest it in the substr() function.

1 Like

Yes, can use column expression node.

Here is my column expressions code for your reference.

This works, but…always is something else :smiley:

I think that I don’t know how to configure node.

First I want to replace letters like in this picture, and than i need to insert “.”.
I would like node to execute rule by rule.

Hello @rsamec

You are right; I was just fast tracking and visualizing the logical elements disaggregated in the table.

I thought as well on @ArjenEX 's point (about string length), but tried to keep on description and wait for feedback.


Have you considered just removing the dot from the other excel file for your join? Just curious

1 Like

It could work.
I was thinking to do all modification in only one excel table.

Ok, i will think about it :slight_smile:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.