I have an input like Input 1 : THE MISSION IMPOSSIBLE
Bot should check the first word is if it contains ‘THE’ so it has to remove the word ‘THE’ and output should be - MISSION IMPOSSIBLE Input 2 : THE THE THE MISSION IMPOSSIBLE
Output should be - MISSION IMPOSSIBLE
Help needed with sample code.
The above given solution is working fine only when the word THE is mentioned in caps. It should work irrespective of the input is in caps or in small characters.
Sorry for the changes…
The above given solution is working fine only when the word THE is mentioned in caps. It should work irrespective of the input is in caps or in small characters. How to edit in the current code - RightSide: Regex.Replace(strText,Pattern,“”).Trim()
@Chetan
Input : THE THE MISSION THE IMPOSSIBLE
Output should be : MISSION THE IMPOSSIBLE
Your code removes THE whereever it is found in the line.
It should remove only THE found initially as mentioned in above example.
Also same for the word AND also. Word AND also should be removed.
Regex.Replace(strText,Pattern,“”).Trim()
and use replace variable.tostring.tolower.replace(“and”,“”)
If i use the above code 2 cases are getting failed
THE the AND THE MISSION THE IMPOSSIBLE
Expected Res: MISSION THE IMPOSSIBLE
Actual Res: the MISSION THE IMPOSSIBLE
THE the THE MISSION the and IMPOSSIBLE
Expected Res : MISSION the and IMPOSSIBLE
Actual Res: mission the impossible
@Nived, not yet tried this code. This - MISSION THE IMPOSSIBLE wont be static any words will be there.
Question is any lines starts with
THE
THE THE
AND
AND THE
What ever the no of times or combinations of AND, THE comes it should be removed only should be retained including AND THE