A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Replace carriage return into normal text

  1. #1
    Junior Member
    Join Date
    Oct 2008
    Posts
    9

    Replace carriage return into normal text

    How do I convert a multiline of text from an input box into a single line of text except I would put a string of characters to replace the carriage return?

    from:

    Hello
    world
    I
    am
    here.

    to:

    Hello~|~world~|~I~|~am~|~here.

    Tried this and other variants but doesn't work.
    txt = txt.split(ASCII(13)).join("~|~");

  2. #2
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    actionscript Code:
    someButton.onPress = function(){
        var string1:String = input_txt.text;
        var splitArray:Array = string1.split("\r");
        var joined:String = splitArray.join("~|~");
        trace("Joined: "+joined);
    }

  3. #3
    Junior Member
    Join Date
    Oct 2008
    Posts
    9
    Thanks it works great!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center