replace linebreaks with another string - InfoPath Dev
in

InfoPath Dev

replace linebreaks with another string

Last post 04-29-2011 06:43 AM by jlibrizzi. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 04-29-2011 05:50 AM

    replace linebreaks with another string

    I have a form with two fields. The intent is that a user can paste data into textfield1, and textfield2 will rewrite and reformat it in such a way that it can be reused in another application. I've been able to successfully alter everything except when the data in textfield1 has linebreaks. I need:
    string1
    string2
    string3
    to be rewritten in textfield2 as "string1XXXstring2XXXstring3".

    translate(textfield1,@crlf,"XXX") won't work since translate is one-to-one characters.
    Any solutions are greatly appreciated, no code solutions even more so!
  • 04-29-2011 06:43 AM In reply to

    Re: replace linebreaks with another string

    I found the answer in another post by user Qwerty.

    Set the default value for textfield2 = textfield1 (this prevents the original data from being overwritten)

    Then run the following rule on textfield2:
    if textfield2 contacts @crlf
    concat(substring-before(textfield2, @crlf), "XXXX", substring-after(textfield2, @crlf))

    It continues to cycle through textfield2 until each linebreak is replaced.

    Thanks Qwerty!!!!
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.