In the split function, I understand " " (space is the delimiter), but what is ‘c’?
my apologies but I still do not understand what the c means, is it meant to tell the computer that the variables are characters?
.Split argument needs “Char”(Character) type, not string type.
" "c means “Use this space as a char, not as string” in .NET grammer.
(This c is capital of “char”)
As the another case, in UiPath, I often use “D” for define Decimal Type.
For example, 1.01D means “this value defines as Decimal type, not Double type”.
(To explain difference between Decimal and Double is hard work, you can understand “Double is faster at caliculating, Decimal is slower but more accurate in decimal system”.)
Thank you Honoka!
Thank you
Here ‘c’ is the Character because of your splitting single character (space).
This C how it’s work:
- it will convert a given string into a character.
instead of using that technique you can also try this way also myString.split(CChar(" ")).
Thanks,
Arunachalam
As what I have understood from the comments, the argument needed for split method needs to in Char Type not String Type. Since " " is String and not char adding c like, (" "c) after it, converts it to Character. Am I right?
A good resource for stuff like this is the .NET Framework Library.
When Option Strict is On in VB (and it always is in UiPath), you need to specify when a Char is literal, as explained here:
There is more than one way to meet that requirement though. Ex.:
myString.Split(" "c)
myString.Split(convert.ToChar(" "))
myString.Split(Char.Parse(" "))
By using" "c means space as character if we r using "|"c means what
In case we need to select the name of the file without extention, we use expression file.Name.Split(".“c)(0).
For example the file name is: “FileExample.pdf”
In this case:
file.Name.Split(”.“c)(0) == “FileExample”
file.Name.Split(”."c)(1) == “pdf”
P.S: I tried forum.
@imandric_11 , that means that the pipe | character will be used as a delimiter to split the string. I hope this helps.
It’s not possible to split without any common seperator.You have to use another logic if you’ve finite number of data.
C for “Character”