Replace character in string
Comments
-
Hello!
I have a form that collects a user’s input. Some users may input a (“), For instance, “test” which I want to replace with (‘), ‘Test’. Is there a step I can use to replace this character?
-
Hello!
We have a “Replace Text” step that allows users to replace characters in a string.
Navigate to the Step tab>Data>Text> drag and drop the “Replace Text” step to the workspace.[color=rgb(127, 140, 141)][font=Roboto][img]att1[/img][/font][/color]
The following inputs need to be configured:
[color=rgb(127, 140, 141)][font=Roboto][img]att2[/img][/font][/color]
[ul][li] [b]Replace With[/b]: This is the character that will replace the original character;
[/li][li][b]Source[/b]: This is the source the text is coming from
[/li][li][b]To Replace:[/b] This is the character that we are trying to replace.
[/li][/ul] -
Can we use this to replace newline characters within a string with something like
? -
This “Replace Text” step basically replaces any character from the string irrespective of the position or what the character is. So, we think you should be able to use this step without any issues.
-
Could you give an example? What would be the "to replace" value if we wanted to identify/replace line breaks within a string with a specific string (like a newline character)?
-
Hello,
As requested, I have attached an example screenshot for your reference with definitions given below
[ul][li][b]Replace With[/b]: This is the character that will replace the original character (
in this case)[/li][li][b]Source[/b]: This is the source the text is coming from[/li][li][b]To Replace:[/b] This is the character that we are trying to replace. (probably
in this case if you are treating
as the line break)[/li][/ul]
[img]att1[/img]Let me know if this doesnt answer your question.
Thank you.
[i]edited by osman@decisions.com on 1/27/2022[/i] -
Thank you for the example! How the step works is pretty straight forward, however Im not sure this example answers the question for the case Im working with..
What were seeing is Decisions is outputting, in a JSON message, something like this:
"message": "Here is a message with line breaks.
And another line.
And a third line."
When we want it to output something like:
"message": "Here is a message with line breaks.
And another line.
And a third line."
In this case, Im not sure telling it to replace
with
does the trick..This is difficult to debug as well, without putting it in a flow with a form to enter text with line breaks, as the debugger doesnt allow entering a string with line breaks present. Is there a way to do this in the debugger?
-
Hey
Since any line breaking character isnt present in the string, we cant use a ReplaceString step here.
Ive built an example for your reference that takes in a string similar to what comes out of the JSON message and gives us a merged string with
as a separating character. The form in this flow accepts a multi-line string, the SplitStringByNewLine step splits the received string into a list of strings and using the ForEach and IsEmpty rule, the empty lines are removed. All the strings are merged with a separating character
using the MergeStringListToSingleString step.
However, if you have any issues or queries, feel free to reach out to us at support@decisions.com.
Thanks
Osman -
We have a “Replace Text” step that allows users to replace characters in a string.
Navigate to the Step tab>Data>Text> drag and drop the “Replace Text” step to the workspace. -
To create a Slack channel, cant have upper case in a string. Problem is my input comes in with an upper case and the channel name is this input.
Whats best way to convert first character in a string (which is upper case) to lower case? -
Hi,
We can convert just the first character of the string to lower case by following the below process
[ul][li]Split the first character from the string using the [i]Split String By Character Positions[/i] step[/li][li]Use the [i]Lower Case[/i] step to change the casing[/li][li]Merge the Lower Case output to the other part of the string using the [i]Merge To Plain String [/i]step.[/li][/ul]I have built and attached a sample project for reference. Please refer to it and let me know if you have any questions.
[i]edited by athuluru.lakshmi@decisions.com on 3/22/2022[/i]
[i]edited by athuluru.lakshmi@decisions.com on 3/22/2022[/i] -
great, thanks!
Howdy, Stranger!
Categories
- 4.2K All Categories
- 67 General
- 11 Training
- 202 Installation / Setup
- 1.1K Flows
- 106 Rules
- 262 Administration
- 212 Portal
- 490 General Q & A
- 695 Forms
- 333 Reports
- 3 Designer Extensions
- 47 Example Flows
- 52 CSS Examples
- 1 Diagram Tile
- 7 Javascript Controls
- 179 Pages
- 5 Process Mining
- New Features
- 179 Datastructures
- 69 Repository
- 221 Integrations
- 28 Multi-Tenant
- 27 SDK
- 78 Modules
- 56 Settings
- 25 Active Directory
- 12 Version 7
- 35 Version 8
- 83 Lunch And Learn Questions