This is a blog about Flash & AS by betaruce :-)



Calendar

August 2007
M T W T F S S
« Jul    
  1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31  

June 1, 2007

AS tips: \ in String

Filed under: Using Flash, Actionscript — betaruce @ 2:01 am

If there is "\" in a String variable, it will be "deleted" automatically and immediately (since "\" is usually used to represent something e.g. "\n" means a line break), and you won't be able to replace it e.g. with regular expression. To overcome this, you may use "\\".

Actionscript:
  1. var link:String="C:\Program Files\Adobe";
  2. trace(link);
  3. // ouput --> C:Program FilesAdobe
  4.  
  5. var link2:String="C:\\Program Files\\Adobe";
  6. trace(link2);
  7. // ouput --> C:\Program Files\Adobe

However, if the value is taken from a textfield (either dynamic or input textfield), the "\" will still remain.

Actionscript:
  1. // There is a dynamic text field on stage
  2. // with value "C:\Program Files\Adobe"
  3.  
  4. trace(txtField.text)
  5.  
  6. // output --> C:\Program Files\Adobe

• • •

1 Comment »

  1. […] Original post by betaruce Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages. […]

    Pingback by AS tips: in String | Talk Utopia — June 1, 2007 @ 2:20 am

Comments RSS • TrackBack URI

Leave a comment

Powered by: WordPress • Template by: Priss

cheap phentermine phentermine site phentermine effects online phentermine phentermine prescription buy phentermine online phentermine alternatives phentermine deit pill cheap generic phentermine order phentermine online Clenbuterol Phentermine online pharmacy phentermine buy phentermine weight loss pill Cialis Comparison Viagra Cheap Viagra Online Prescription generic viagra sale viagra online viagra viagra pill discount sale viagra Generico Impotencia Viagra viagra sildenafil citrate Xanax Online xanax order xanax valium versus xanax