-
Senior Member
Hi,
I am loading a variable into flash that normally has half as many returns (\n) I don't know how this happens, but when it goes into flash, it adds extra returns... Does any one know how to remove all of either the \r or the \n chars?
I would need this to be an action script answer... I am stumped... I have tried and tried, but I may just be doing the wrong thing...
Thank you for any help you can give me!
-
If you know how many extra characters there are, use:
Code:
myStr=myStr.slice(0,myStr.length-2);
This example returns the string with two characters cut off.
-
Senior Member
Thank you, but...
My problem is not with extra characters at the end, my problem is on a multi-line text area. Every return carage becomes 2 return carages. I want to remove either the \rs or the \ns...
Any one?
Thanks.
-
I'm sorry if I'm misunderstanding, but \rs and \ns are single characters which can be removed as such.
If you had a string:
myVar="abcdeg\r\n"
then the code I gave will remove the \r and \n.
I wasn't aware that Flash added them when it read variables (I'm sure it doesn't, because it doesn't when I use it ).
-
Senior Member
Actually, the additional return chars are when I load from a form variable into a flash variable with JavaScritp. What I want to remove is not as simple as removing \r\n from abcdeg\r\n it's more like removing all of the \r from a string like: abcd\r\nefghij\r\nklmno\r\npqrs...
Like I said in my second post, I am working on a multi-line text field.
Thanks again for your help!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|