I have a column with strings of varying length. All strings have 1 semicolon separating the first and last part of the string.
some strings with no 'periods':
_______________;______
some strings with 1 period
______.______;_______
some strings with 2 periods
___._______._____;_________
I want to create a new column and populate it with the string of interest with the following conditions:
I'm having trouble with this since the length of characters between each period can vary
any help on the best way to achieve this would be greatly appreciated! thank you!
Assuming there are no periods after the semicolon, this script should work:
(Change "Column" to the name of the column with strings)
col = Column( "Column" );
For Each Row(
w = Words( col[], ".;" );
If( N Items( w ) == 4,
col[] = w[1] || "." || w[2] || ";" || w[4]
);
);
Assuming there are no periods after the semicolon, this script should work:
(Change "Column" to the name of the column with strings)
col = Column( "Column" );
For Each Row(
w = Words( col[], ".;" );
If( N Items( w ) == 4,
col[] = w[1] || "." || w[2] || ";" || w[4]
);
);
thank you MS! this works great.
How would I modify this so that instead of editing the contents of "Column", it instead populates a new column with the new edited string?
col = Column( "Column" );
new_col = New Column( "New Column", character );
For Each Row(
w = Words( col[], ".;" );
If( N Items( w ) == 4,
new_col[] = w[1] || "." || w[2] || ";" || w[4],
new_col[] = col[]
);
);