I have a similar problem also, and I cannot get it to work with these tips. I would have to split a string by empty lines. Heres an example of a string:
Name 2 Name 345 Name 1
Name 1 Name 2 Name 3 1234
So, I would have to split it from where ever there’s an empty line. So it would become two strings:
there is a split activity… we can specify the property based on which we should split like space, tab or new line… if we use that activity it will be easy no need of coding required…
I know this is a old post, however I was stuck in split string and was working on resolution which I wanted to share. I wanted to get the file name using the “Path.GetFileName” function into a single variable. the sample workflow works fine, you just need to specify the complete path along with the file name under “Path.GetFileName” function. Sample uploaded.Get_FileName_String_Split.zip (2.2 KB)
For the love of god… splitting a string shouldn’t be so nuanced that it requires this much discussion :-/
Given SomeString contains a multi-word string, I tried simply using the Assign activity to assign SomeString.Split(" ") to a string array variable… and I keep getting the an error “Option Strict On disallows implicit conversions from string to char”.
I ended up having to Google the error message and change my approach to SomeString.Split(Convert.ToChar(" "))
Yeah, the Split function requires a character or character array.
Alternatively you can use ‘c’ or (0) to indicate that it’s a character. SomeString.Split(" "c) or SomeString.Split(" "(0))
You can also use a string wtih brackets to make it an array. SomeString.Split({" "},System.StringSplitOptions.None)
and the string can be anything. System.StringSplitOptions.RemoveEmptyEntries will also get rid of empty items.
Suppose ABC variable is stored with value “This is not game”
String ABC=“This is not a game”
There is a Split function available in String Class.
It operates two parameter
1.String name on which the operation should be performed
2.Delimiter for the string
It returns String of array, so use appropriate code.
String array_of_string=Split(ABC,“not”)
OR
String array_of_string=String.Split(ABC,“not”) --------// To be specific
please I want to split from variable like this the name of the file is Rabeaalhaj _1234_basic.pdf here I want to put the name in one variable and the ID in another variable and the word basic in variable also so please how can I split them
“Please take note of your order reference: 156”
I want to separate 156 from the above expression and want to write in an excel. I just separated using a split string but when written in an excel it only writes “System.String” instead of 156.