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
+2
person also asked this
people also asked this
Replies
9 replies
Answers
1 answer
Subscribers
9 subscribers
Views
13328 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
Text Functions
ovidiubalan
over 7 years ago
Hello
I need to split a big text(200 characters let's say) so that at each 4th character I want to insert a new line.
The purpose is to display this big text in a paging grid.
Any ideas ?
Thanks in advance !
Ovidiu
OriginalPostID-251160
Discussion posts and replies are publicly visible
Parents
0
PhilB
A Score Level 1
over 7 years ago
The code above won't quite work - try running it with a text value of "123412341234123412" and you'll see the problems. Not only does it not insert at the correct locations, it also truncates the text if the length isn't divisible by the length that's required for the split.
This problem is a bit tricky due to the way insert works; it would seem that, for a split of length 4, that the correct insert locations would be {5, 10, 15, 20} but that's not actually the case - they should actually be {5, 9, 13, 17} as insert does all the inserts at once and doesn't re-evaluate the string each time an entry is inserted.
I've attached a modified piece of code that behaves as required. As @chetany has said, simply replace "@" at line 23 with char(10) to see the results as required.
split_text.txt
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Reply
0
PhilB
A Score Level 1
over 7 years ago
The code above won't quite work - try running it with a text value of "123412341234123412" and you'll see the problems. Not only does it not insert at the correct locations, it also truncates the text if the length isn't divisible by the length that's required for the split.
This problem is a bit tricky due to the way insert works; it would seem that, for a split of length 4, that the correct insert locations would be {5, 10, 15, 20} but that's not actually the case - they should actually be {5, 9, 13, 17} as insert does all the inserts at once and doesn't re-evaluate the string each time an entry is inserted.
I've attached a modified piece of code that behaves as required. As @chetany has said, simply replace "@" at line 23 with char(10) to see the results as required.
split_text.txt
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data