Basic usage of String Maniplulation


NAME


String Manipulation is used to Find/Relace/Split a word in a string or a text file with Regular Expression


SYNOPSYS


String Manipulation needs next parameters or options.

Parameters


String operations

  • Type of operations
  • Support operations: Find, Replace, and Split

Regular Expression

String to handle

  • a source string

String from file

  • a source filename when using a file instead of a string (Text file only)

Get Length

  • Get the number of times a match occurred

Options


String to replace

  • It literally means 'string to replace'

Ignore Case

  • case insensitive pattern is applied.

Set number of …

  • the iteration limit of 'operation' to be applied the results of matching
  • Default: 0 (no limit)
  • Example

    Total matching is “5”, and If you set this “1”, this operation will be applied on the 1st matching.


EXAMPLES


EX1. Gets the number of occurrences of the word 'bear' in the string.


Parameters

Parameters/OptionsValue
String operationfind
Regular Expressionbear
String to handleThe bear and the maiden fair.
Get LengthChecked

Results

  • 1
  • 'bear' is found just once in a string.

EX2. Gets the number of occurrences of the word 'lann*' in the string.


Sample text file

  • Filename: Game_of_thrones.txt
  • Contents:

    The bear and the maiden fair. The night is dark and full of terrors. A Lannister always pays his debts. What is dead may never die. May the Father judge him justly. Bastards are born of passion, aren't they? We don't despise them in Dorne. Unbowed, Unbent, Unbroken. A Lannister always pays his debts. The tourney of Ashford Meadows. When you play the game of thrones, you win or you die.


Parameters

Parameters/OptionsValue
String operationfind
Regular Expressionlann*
String from fileC:\TestRun\Game_of_thrones.txt
Get LengthChecked
Ignore Casechecked

Results

  • 2
  • There are two lines in the file that contain 'Lannister'.

EX3. Replace a word in a file

Parameters

Parameters/OptionsValue
String operationreplace
Regular Expressionlann*
String from fileC:\TestRun\Game_of_thrones.txt
String to replaceStark
Ignore Casechecked
Results typeFile
File PathC:\TestRun\Replace_output.txt
Variable name{{g1.v1}}

You have to define a UserVariable first to store the replace results.
ex) {{g1.v1}}


Results

  • All 'Lannister' changed to 'Stark'.

    The bear and the maiden fair. The night is dark and full of terrors. A Stark always pays his debts. What is dead may never die. May the Father judge him justly. Bastards are born of passion, aren't they? We don't despise them in Dorne. Unbowed, Unbent, Unbroken. A Stark always pays his debts. The tourney of Ashford Meadows. When you play the game of thrones, you win or you die.


EX4. Split a word by SPACE (\s).

Parameters

Parameters/OptionsValue
String operationsplit
Regular Expression\s
String to handleThe bear and the maiden fair.

Results

The
bear
and
the
maiden
fair.

PLATFORM


Here is the supported platform for this plugin.

  • This plugin support Windows 10 and above.
  • This plugin support Linux (Ubuntu).
  • This plugin support Mac.

Version


  • 1.522.1442


Limitation

SEE ALSO

LICENSE