Team,
There is q requirement in which we need to split the Input Text on below conditions :
-
If Input Text is more than 1 word = Bank Name ABCDE
Then Output FName = 1st Word ie Bank
And Second Name = Remaining Words ie Name ABCDE
-
If Input Text is only 1 word = Bank
Then Output FName = 1st 2 letters only ie Ba
And Second Name = Remaining letters ie nk
Any suggestions will be helpful.
Thanks
Parvathy
(PS Parvathy)
2
Hi @prerna.gupta
Try this:
Assign: inputText = "Bank"
If: inputText.Split(" "c).Length > 1
Then:
Assign: FName = inputText.Split(" "c)(0)
Assign: SecondName = String.Join(" ", inputText.Split(" "c).Skip(1))
Else:
If: inputText.Length <= 2
Then:
Assign: FName = inputText
Assign: SecondName = ""
Else:
Assign: FName = inputText.Substring(0, 2)
Assign: SecondName = inputText.Substring(2)
Hope it helps!!
rlgandu
(Rajyalakshmi Gandu)
3
@prerna.gupta
If(inputText.Contains(" "), inputText.Split(" "c)(0), inputText.Substring(0, Math.Min(2, inputText.Length)))
Parvathy
(PS Parvathy)
4
Hi @prerna.gupta
These below syntaxes will work too
Assign-> inputText = "Bank"
Assign-> FName = If(inputText.Split(" "c).Length > 1, inputText.Split(" "c)(0), If(inputText.Length <= 2, inputText, inputText.Substring(0, 2)))
Assign-> SecondName = If(inputText.Split(" "c).Length > 1, String.Join(" ", inputText.Split(" "c).Skip(1)), If(inputText.Length > 2, inputText.Substring(2), ""))
Assign-> inputText = "Bank Name ABCDE"
Assign-> FName = If(inputText.Split(" "c).Length > 1, inputText.Split(" "c)(0), If(inputText.Length <= 2, inputText, inputText.Substring(0, 2)))
Assign-> SecondName = If(inputText.Split(" "c).Length > 1, String.Join(" ", inputText.Split(" "c).Skip(1)), If(inputText.Length > 2, inputText.Substring(2), ""))
Hope it helps!!