public class StringManipulation extends Object
Modifier and Type | Field and Description |
---|---|
static org.openqa.selenium.WebDriver |
driver
The driver.
|
Constructor and Description |
---|
StringManipulation(org.openqa.selenium.WebDriver driver)
Instantiates a new string manipulation.
|
Modifier and Type | Method and Description |
---|---|
static String |
appendStringAtIndex(String originalStr,
int appendAtIndex,
String appendString)
Append new string at specified index in original string.
|
static String |
concatString(String str1,
String str2)
Concat/Join two string.
|
static String |
deAppendStringAtIndex(String originalStr,
int deAppendFromIndex,
String deAppendString)
DeAppend/Remove string from specified index in original string.
|
static String |
deleteCharInString(String str,
int indexToDeleteChar)
Delete char in string at specific index.
|
static void |
regex(String str,
String regEx)
Finds all occurrences of a given Regular Expression in a given input String.
|
static String |
removeSingleQuoteFromString(String str)
Removes the single quote from start and end of a string.
|
static String |
replaceCharInString(String str,
int index,
char replaceWith)
Replace char at specific index in a string with any other char of your choice.
|
static String[] |
splitString(String inputStr,
String delimiter)
String will be split after each occurrence of delimiter and returns the array of Strings.
|
public StringManipulation(org.openqa.selenium.WebDriver driver)
driver
- the driverpublic static String appendStringAtIndex(String originalStr, int appendAtIndex, String appendString) throws Exception
originalStr
- the original str in which you wish to append stringappendAtIndex
- the index at which you wish to appendappendString
- the string which will be appended at given index in original stringException
- the exceptionpublic static String deAppendStringAtIndex(String originalStr, int deAppendFromIndex, String deAppendString) throws Exception
originalStr
- the original str in which you wish to DeAppend/Remove stringdeAppendFromIndex
- the index from which the string needs to be removeddeAppendString
- the string which needs to be removed from index specifiedException
- the exceptionpublic static String concatString(String str1, String str2) throws Exception
str1
- the str1str2
- the str2Exception
- the exceptionpublic static String[] splitString(String inputStr, String delimiter) throws Exception
inputStr
- the input strdelimiter
- the delimiterException
- the exceptionpublic static String replaceCharInString(String str, int index, char replaceWith) throws Exception
str
- the input stringindex
- the indexreplaceWith
- Old char at index will be replaced with this new charException
- the exceptionpublic static String deleteCharInString(String str, int indexToDeleteChar) throws Exception
str
- the input stringindexToDeleteChar
- the index to delete charException
- the exceptionpublic static String removeSingleQuoteFromString(String str) throws Exception
str
- the str with quotes. Ex:"'asssssssssz'" or "'asssssssssz" or "asssssssssz'"Exception
- the exception