String of characters

Hi guys.

You can help me, as I do to find the last character in this chain
33 174 NA NA NA

I tried with item.split ("". ToCharArray) (5)

but not all times in that position so I would need to find the last value in the line this line can change for example

33 174 NA NA $ 35

or may be

33 174 NA $ 98 NA

What I need is to capture the last value either numeric or character

Hi guys.

You can help me, as I do to find the last character in this chain
33 174 NA NA NA

I tried with item.split ("". ToCharArray) (5)

but not all times in that position so I would need to find the last value in the line this line can change for example

33 174 NA NA $ 35

or may be

33 174 NA $ 98 NA

What I need is to capture the last value either numeric or character

Thanks for your help

1 Like

Hi @cristian_urrego
You mean you want the last string like here in
33 174 NA NA $ 35
You want 35

And here 33 174 NA $ 98 NA
You want NA
Am i right…?
Cheers @cristian_urrego

1 Like

Well in that case you can get like this buddy @cristian_urrego
Out_lastvalue = Split(item," ").Last.ToString

Where Out_lastvalue is a variable of type string

Kindly try this and let know whether this works or not
Cheers @cristian_urrego

Did that work buddy @cristian_urrego

Hello @Palaniyappan

Thank you very much for your prompt response if what I need is the last character in that line, try what you tell me but keep showing me all the liena instead of the last character

@Palaniyappan

this is what throws

and I just need you to show NA ,
I thank you if you help me with this friend

1 Like

Buddy there must be a space between double quotes
Where here in the assign there is no space.
Kindly have a space between the quotes
Like this… @cristian_urrego
Split(item," ").Last.ToString

1 Like

Small correction…
Kindly** copy the space between $33 and $174 from your output panel **which is written via write line activity
And paste that space in our expression between double quotes in our split method, I mean Split(item,“HERE”)…
@cristian_urrego

1 Like

Hey @cristian_urrego

Buddy just use below sample for your reference :slight_smile: Sample.xaml (4.9 KB)

String Str1 = "33   174   NA   NA           $35   "
String Str2 = "33       174  NA    $ 98 NA"

Writeline - Str1.Split(" ".ToCharArray,StringSplitOptions.RemoveEmptyEntries).Last.ToString // Output - $35

Writeline - Str2.Split(" ".ToCharArray,StringSplitOptions.RemoveEmptyEntries).Last.ToString //  Output - NA

Buddy @Palaniyappan

He do not need to copy space. just after split he can remove empty entries from returned array by split and can access last index of that array using LAST()

Regards,!!
Aksh

3 Likes

Thanks akshay…
Later realised like why i gave that like a :)child…i was not able to make a edit…it gave me a prompt that i exhausted the edit option and i need to wait for 5 more hours. No worries… thank you… I take this as a opportunity…i saw your interview with uipath community channel in youtube…great job buddy…my best wishes…keep going
Cheers @aksh1yadav

Hey @Palaniyappan

No worries :slight_smile:

it is ok :slight_smile: might be because i saw you multiple times :stuck_out_tongue: may be to answer in hurry you post just something then make an edit so your post will sshow up :stuck_out_tongue:
might be wrong :smiley:

Thanks buddy :slight_smile: will keep improving myslef with the help of such talented peers like u and others on the forum though less active but will try my level best :slight_smile:

Keep Helping…!!

Regards…!!
Aksh

3 Likes

Hehe… :slight_smile:
Cheers @aksh1yadav

1 Like

Hello @aksh1yadav
Thank you very much for your answer . I actually worked well with the example you gave me. I am something new in Uipath can you explain me well how that sentence works I do not understand it in its entirety again thanks for your help you are very kind

Hola @Palaniyappan
Hello
Thank you very much for your help, friend, it was very helpful for me

1 Like

Hey @cristian_urrego

Sure :slight_smile:
i will explain things in code and to understand and map with Uipath you can see attached Sample for your understanding :), in case of any query/ Doubt you can ask…!!

These are 2 String Variable I have taken for input or source of String data on which we have to perform desired manipulation or operation.

This will perform Split operation on String Variable. To know more about Split.

String.Split Method -
Method splits a string into an array of strings separated by the split delimiters. The split delimiters can be a character or an array of characters or an array of strings.

In our above case we are splitting our input string data based on space character so i used " " as a delimiter.

.ToCharArray i have to use because Split supports only Character or String as an input.

to omit empty array elements from the array returned.

Last is found in System.Linq namespace and can be used on arrays, Lists, or anything that implements IEnumerable to get last Element.

Regards…!!
Aksh

1 Like

Hello @aksh1yadav

Thank you for your time and the explanation it has been clear to me how it works and when to use it is very useful for what I am doing. Again thank you friend I will be investigating every day to make better projects. Regards …

2 Likes

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