How to split string by length, 35 characters should be stored in one string and rest in another string. Even if 36th character is ‘u’ in 2nd Dumpty, we have to store that in last name itself to get meaningful name.
example : Full Name: Humpty Dumpty Sat on a wall Humpty Dumpty Had Great Fall
should be split to
First Name : Humpty Dumpty Sat on a wall
Last Name : Humpty Dumpty Had Great Fall
Can Anyone please help me…
Thank you
Try like this use substring method
“Humpty Dumpty Sat on a wall Humpty Dumpty Had Great Fall”.Substring(0,27)
“Humpty Dumpty Sat on a wall Humpty Dumpty Had Great Fall”.Substring(28)
Hope this helps
Regards
Sudharsan
Thank you @Sudharsan
But here Am using array of string Just for example i have given only one string that is “Humpty Dumpty Sat on a wall Humpty Dumpty Had Great Fall” if it is different then how to do? Till 35th character i have to extract, but it should have meaning.
I want like this,
Ex1 : Humpty Dumpty Sat on a wall Humpty Dumpty Had Great Fall First Name :Humpty Dumpty Sat on a wall
Last Name :Humpty Dumpty Had Great Fall
Ex2 :Johny Johny yes papa Eating Sugar No Papa
First Name :Johny Johny yes papa
Last Name :Eating Sugar No Papa
Ex3 :Hickory dickory dock The mouse went up the clock
First Name :Hickory dickory dock
Last Name :The mouse went up the clock
Can Anyone please help me
Hello @Vanitha_Agamin,
Is there any pattern to split? for example, split after the third word. Or after this word split.
There is no pattern, If the Name comes like that we have to split that into 2 part, first part should have the value of first name and second part should have the value of last name
Hi @Vanitha_Agamin ,
Sorry to say but its impossible to split a string in the way you want to without providing a solid criteria.
As humans, we know what makes sense and what doesn’t, but robots operate purely on the logic we program it with.
If we can’t translate it into a set of conditions for the robot to adhere by, we won’t have a proper code.
Kind Regards,
Ashwin A.K
ok. Thank you