String Manipulations based on length

Hello All,

I am facing an issue with manupulation of string.I am getting value in string as:

"Character Counter is a 100% free
To find out the word and characte
Character and word limits are quite

For students, there are usually limits or minimums for homework assignments.

Character Counter is a 90% free
To find out the word and character
Character and word limits are fine."

I have to enter these string in a comment box where the limitation of comment box is 115 characters only. If string characters are increasing then have to split the first 115 charcters and enter the comments two times.

Output I am getting is:

Character Counter is a 100% free
To find out the word and characte
Character and word limits are quite

For students, t

The issue is when I am splitting the character It is splitting in between the words (incomplete).
Can we do something like splitting the characters in such a way so the text should display appropriately.

It Would be a great help.
Happy Coding :slight_smile:

@Parth_Doshi @supermanPunch

Hi @Happy_Coding ,

Could you maybe check with the below Expression :

(From i in Enumerable.Range(0,CInt(Math.Ceiling(strInput.Count/115))).Select(Function(x)x*115) Select String.Join("",strInput.Skip(i).Take(115).ToArray)).ToArray

image

Thanks for your response.

Do I need to use this code inside “Invoke code”

@Happy_Coding

It’s an Array variable you need to assign, Try to use with Assign activity

Thanks,
Srini

@Happy_Coding ,

Apologies. I may have not been fully clear on the usage part. But as @Srini84 mentioned, the resultant of the Expression is of type Array of String.

Hence you would require a variable of the same type. The Expression can be used in the Assign Activity.

For a Faster or a Quicker approach, we use Debug Panel and showcase you the results.

Hi @supermanPunch

Thanks for providing the solution.
I tried the same and it is showing as below:

image

Can we do something like splitting the strings after first 10 lines ?

Note : 10 lines is because the original string is more bigger than the above.

It would be helpful.

@Happy_Coding ,

The above was done based on the requirement mentioned earlier.

Could you let us know what should have been the Output for that data ?