From wiki.ginstr.com
Jump to: navigation, search

gn:act_replaceText

Description
Action is used to replace text by regular expression pattern and to store it again to target
Action returns
void

Action signatures

Replace parts or whole text in target widget with content

[gn:act_replaceText]|[target,sourcePattern,sourceReplacementContent]
Parameter Description
target target on which text replacement will be performed
sourcePattern source of pattern for text replacement. Use regular expression, with pattern.
sourceReplacementContent source of replacement content for text replacement

Example

initial value
@variable/test = name.surname@domain.com
variables.xml
<variable id="test" type="string"/>
strings.xml
<string name="pattern">@|\.</string>
<string name="replacementString">_</string>
screen.xml
<FrameLayout
    android:id="@+id/exampleFrame"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:visibility="gone"
    gn:act_set="[gn:act_replaceText]|[@variable/test,@string/pattern,@string/replacementString]" />
after action execution
@variable/test = name_surname_domain_com