I have one array which can consists some values. So i want to find value which occurs at the end of the string.
Example:
Input array:
{SBI,AXIS,ICICI}
Input string:
" Transaction from SBI bank, sender is ICICI AND RECEIVED TO AXIS BANK"
Output:
AXIS
EXAMPLE 2:
“RECEIVED TO AXIS bank from sender SBI to ICICI BANK”
Output:
ICICI
Can we do that without loop…?
Gokul001
(Gokul Balaji)
March 3, 2022, 9:38am
2
hI @Mansi_Mhatre
Mansi_Mhatre:
{SBI,AXIS,ICICI}
Try this to get last value from the array
Textfile = {SBI,AXIS,ICICI}
TextFile(TextFile.Length-1)
Here is the SS
Regards
Gokul
Yoichi
(Yoichi)
March 3, 2022, 9:59am
3
Hi,
Can you try the following?
inputArray.Where(Function(s) yourString.Contains(s)).OrderByDescending(Function(s) yourString.LastIndexOf(s)).FirstOrDefault
Regards,
Che
(Che)
March 3, 2022, 11:47am
4
Hi @Mansi_Mhatre
Correct me if i’m wrong: You have an input array of bank names, you want to know which one is mentioned last in the string?
Give @Yoichi ’s answer a go.
Otherwise another way you can do it, assuming your string always ends with BANK
you can use split. i.e. strText.Split(" "c)(strText.Split(" "c).Length - 2)
Kind Regards
Thanxx…
I have one more query…
I have string which contains large data, so i want to replace number part with ’ before number.
I am getting csv data in the form of semicolon seperator so while converting that text file to excel. Initial 0 is eliminated after saving file.
So i want solution for this issue.
So if not found then want to convert each only number between semicolons to ’ number.
Sample input string:
Abc;thseh4566;00089990088;updateform;56783pdfd;9876;Bankname
Output:
Abc;thseh4566;'00089990088;updateform;56783pdfd;'9876;Bankname
It should replace 00089990088 and 9876 with '00089990088 and '9876.
Yoichi
(Yoichi)
March 3, 2022, 12:15pm
6
Hi,
The following will work. Can you try this?
System.Text.RegularExpressions.Regex.Replace(yourString,"(?<=;|\n)(?=\d)","'")
Regards,
Please explain this query for improve learning
Yoichi
(Yoichi)
March 6, 2022, 2:15pm
8
Hi,
Which query, in post #3 or #6 ?
Regards,
system
(system)
Closed
March 9, 2022, 2:16pm
9
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.