Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Suggested Answer
Replies
12 replies
Answers
2 answers
Subscribers
8 subscribers
Views
14907 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
how would I trim a mix of newline and space characters from the beginning and en
srinivasm
over 9 years ago
how would I trim a mix of newline and space characters from the beginning and end of a text string? For example,
"
this is
a string
" becomes
"this is
a string"
OriginalPostID-174728
OriginalPostID-174728
Discussion posts and replies are publicly visible
Parents
0
Mike Schmitt
over 9 years ago
I've come up with the following which seems to work:
with(
local!array: split(
substitute(ri!text, char(13), ""),
/* removing char(13)s first - newlines will ALWAYS have char(10) and SOMETIMES also char(13) */
char(10)
),
local!secondArray: remove(
local!array,
where(
apply(
rule!APN_isBlank(_),
local!array
)
)
),
trim(joinArray(local!secondArray, char(10)))
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Reply
0
Mike Schmitt
over 9 years ago
I've come up with the following which seems to work:
with(
local!array: split(
substitute(ri!text, char(13), ""),
/* removing char(13)s first - newlines will ALWAYS have char(10) and SOMETIMES also char(13) */
char(10)
),
local!secondArray: remove(
local!array,
where(
apply(
rule!APN_isBlank(_),
local!array
)
)
),
trim(joinArray(local!secondArray, char(10)))
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data