dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: how to do a string repplace

  1. #1

    how to do a string repplace

    Hi there,

    I need a simple string replace like php's str_replace('search_string', 'replace_string', 'string')

    i just cant work it out!!!
    Having a bad day? grinds-my-gears.com


    What i do

  2. #2
    Senior Member jbum's Avatar
    Join Date
    Feb 2004
    Location
    Los Angeles
    Posts
    2,920
    A method I commonly use (which works like a global string replace on the string) is:

    Code:
    yourString.split( 'seachString' ).join( 'replaceString' );
    This was one of a collection of useful one-liners I posted here:

    http://www.flashkit.com/board/showth...hreadid=535764

    For a one-shot search and replace you can use string.indexOf and splice it out...

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