In this recipe, you will learn how to replace portions of text based on a search and match schema. We will use the replace
command to accomplish this task.
Replacing sections of text can be a powerful part of a mobile app. Follow this recipe's steps to perform a global find-and-replace operation:
Create a new main stack in LiveCode.
Drag a new button to the card.
Name the new button
replaceText
.Add the following code to the button:
on mouseUp local tempText put "EMP001, EMP002, EMP003, EMP004, EMP005" into tempText replace "EMP" with "EMP#:" in tempText answer tempText end mouseUp