Modifier
Using modifiers you could capture right data from extracted text. Some times extracted texts in webpages are not suitable to store in your list, and you should reformat, translate or modify part of it. For example, you may want change date or format of extracted text.
In Neshoonak, modifiers are group of functions that accepts a list of strings as input and outputs modified list of strings. Here you can see list of modifier functions:
Modifier | Example | Description |
---|---|---|
Replace | Replace 'oldValue', 'newValue' | Replaces oldValue to newValue |
SubStr | SubStr 0, 10 | Returns a substring that starts from index 0 and has 10 char. length |
Remove | Remove 0, 3 | Returns a new string in which a 3 characters in the current text beginning at position 0 have been deleted. |
Append | Append 'value' | Add the text 'value' to the end of current string |
Prepend | Prepend 'value' | Add the text 'value' to the beginning of current string |
IsNull | IsNull '' | If current text is null, it will be replaced by the text 'value' |
IsEmpty | IsEmpty 'value' | If current text is null or empty, it will be replaced by the text 'value' |
RemoveExtraSpaces | RemoveExtraSpaces | Removes dupplicate spaces in current text |
Trim | Trim 'separators' | Removes all leading and trailing occurrences of a characters in separators from the current String |
Split | Split 'separator1', 'separator2' | Splits a string into substrings based on the separators |
Join | Join 'separator' | Concatenates all the strings, using the specified separator between them. |
Skip | Skip 0, -1 | Skips first and last strings |
Select | Select 1, 0 | Selects first and last strings and removes others |
Swap | Swap 0, 1 | Swaps positon of first and second strings |
RemoveEmpty | RemoveEmpty | Removes null or empty strings from list |
GetNumber | GetNumber 0 | Get first number from current string |
GetNumbers | GetNumbers | Get all numbers in current string |
DMY | DMY | This function considers input text is a date in Day/Month/Year format as default. It returns a string in Year/Month/Day format |
YMD | YMD | This function considers input text is a date in Year/Month/Day format as default. It returns a string in Year/Month/Day format |
MDY | MDY | This function considers input text is a date in Month/Day/Year format as default. It returns a string in Year/Month/Day format |
GetDateTime | GetDateTime 'YMD' | |
GetDate | GetDate 'DMY' | |
GetTime | GetTime | |
ShamsiToMiladi | ShamsiToMiladi 'yyyy/MM/dd HH:mm:ss' | |
MiladiToShamsi | MiladiToShamsi 'yyyy/MM/dd HH:mm:ss' | |
FormatShamsi | FormatShamsi 'yyyy/MM/dd HH:mm:ss' | |
FormatDate | FormatDate 'yyyy/MM/dd HH:mm:ss' | |
GetRial | GetRial | This function considers input text represents iranian currency. So it extract first number as Rial currency. Also if there is any sign of Toman in input text this function divides the first number by 10. |
GetToman | GetToman | This function considers input text represents iranian currency. So it extract first number as Toman currency. Also if there is any sign of rial in input text this function multiply the first number by 10. |
HtmlText | HtmlText | This function accepts input text as html and returns its inner text |
Element.Attr 'attribute name' | Element.Attr 'alt' | This function has no input. It extracts the 'alt' attribute from first element specified by selector. The output list will be replaced by extrscted attribute name. |