How to split string value with space

i want to split “yashwant kalyan pansare” using space as delimeter.

@yash_p

Try the below :

Split("yashwant kalyan pansare")

By Default the delimiter is space

@yash_p You can also try this

Str[] Output = InputString.Split(" "C)

Please find below sample workflow

Example.zip (2.2 KB)

Actually i’m getting column value from oracle database . that is For getting column value i’m using execute query . Output of execute query is vClientname . Client names are like " yashwant kalyan pansare".


I want to store this client name in array of string.

@yash_p It is a Datatable variable.

Kindly Write the Datatable to an Excel File using Write Range Activity, and Let us know How you would want to Retrieve the Client Name from it.

It would be helpful if you could show us the Screenshot of the Excel after Writing the Datatable


This is client data

@yash_p Most Probably, You would want to Convert the Column values into an Array of String ?

If that’s the case, we can use the Below Expression :

namesArray = DT.AsEnumerable.Select(Function(x)x("P_NAME").ToString).ToArray

where namesArray is a variable of Type String Array

Let us know if this is not what was expected, and please explain what should be Output for the Excel Shown.

Hi @yash_p ,

Sorry, but your requirement is unclear.

I can see that you have extracted it to Excel, but what exactly do you want from it?
Could you maybe show us an example of the desired output so that we can assist you?

Kind Regards,
Ashwin A.K

Hi i have database in which there is column name “P_NAME” we have to get this value EX:- Name = “Ranjeet kumar jadhav”. We have to split this name using space as a delimiter.
same process we have to do with excel .Excel has column name “clientname” with Names. and
If the record is found then we’ll cross check the client name.
For this we’ll split the clientname from MIS Data and from the DB based on the space " " and store each in a separate array.
We’ll compare the length of both array’s.
If the length of arrays is not same and if the below conditions does not match then write this record to the “DataToBeManuallyVerified-YYYYMMDD.xlsx” excel as mentioned in the “General Logic” section and move on to the next record in the MIS Data.
If the length of arrays is same then we’ll compare
IF ((Array1[0] = Array2[0]) AND (Array1[1] = Array2[1]))
{Record Matched}
ELSEIF ((Array1[1] = Array2[0]) AND (Array1[0] = Array2[1]))
{Record Matched}
ELSE
{Record Not Matched}

This is my logic but i’m not getting how to split the string with space

Hi @yash_p ,

Is this what you meant?

image

yourVariable.Split
yourVariable.Split.ToArray().Count()

Kind Regards,
Ashwin A.K

yes but can i use direct database variable means
Dbrows(“p_name”).split

Hi @yash_p ,

Both DataTables are in memory correct?
Also are you iterating through both DataTable and comparing the values?

Kind Regards,
Ashwin A.K

yes both datatabel are stored in variable and i used for each row for iterating

Hi @yash_p ,

If you are interested in retrieving common records, then wouldn’t it be better to compare the strings instead of splitting it on the basis of space?

There will be other entries that contain the exact count but will have totally different words right?

I’d say its better to compare the strings and join them like so →

(From r1 In Dt1.AsEnumerable()
Join r2 In Dt2.AsEnumerable()
On r1("P_NAME").ToString.ToLower.Trim Equals r2("clientname").ToString.ToLower.Trim
Select r1).CopyToDataTable()

JoinTables.xaml (12.6 KB)

Kind Regards,
Ashwin A.K

@yash_p ,

It would be better if you Could Provide us with the Sample Data for Both the Datatables that are to be compared and the Output Data that is Expected.

Here, according to the Statement above, the End Output should be in Excel format. Hence, it would be faster to understand the requirements and suggest a better approach/Logic if you provide the same.